| Index: pkg/polymer/test/build/script_compactor_test.dart
|
| diff --git a/pkg/polymer/test/build/script_compactor_test.dart b/pkg/polymer/test/build/script_compactor_test.dart
|
| index ba536305d9b90ea31c60c36c2eabe4eac358a444..fbf3e03817d4c904d3e98ad19ffe9a1f8c39c725 100644
|
| --- a/pkg/polymer/test/build/script_compactor_test.dart
|
| +++ b/pkg/polymer/test/build/script_compactor_test.dart
|
| @@ -4,6 +4,8 @@
|
|
|
| library polymer.test.build.script_compactor_test;
|
|
|
| +import 'dart:convert';
|
| +
|
| import 'package:code_transformers/tests.dart' show testingDartSdkDirectory;
|
| import 'package:polymer/src/build/common.dart';
|
| import 'package:polymer/src/build/script_compactor.dart';
|
| @@ -20,6 +22,7 @@ void main() {
|
| group('initializers', () => initializerTests(phases));
|
| group('experimental', () => initializerTestsExperimental(phases));
|
| group('codegen', () => codegenTests(phases));
|
| + group('output logs', logOutputTests);
|
| }
|
|
|
| initializerTests(phases) {
|
| @@ -1093,3 +1096,63 @@ codegenTests(phases) {
|
| });
|
| }
|
|
|
| +void logOutputTests() {
|
| + final outputLogsPhases = [[new ScriptCompactor(
|
| + new TransformOptions(injectBuildLogsInOutput: true),
|
| + sdkDir: testingDartSdkDirectory)]];
|
| +
|
| + testPhases("logs are output and converted to warnings", outputLogsPhases, {
|
| + 'a|web/test.html': '<!DOCTYPE html><html><head>',
|
| + 'a|web/test.html._data': expectedData(['web/a.dart'], experimental: true),
|
| + 'a|web/a.dart':
|
| + 'library a;\n'
|
| + 'import "package:polymer/polymer.broken.import.dart";\n'
|
| + '@CustomTag("x-foo")\n'
|
| + 'class XFoo extends PolymerElement {\n}\n'
|
| + 'main(){}',
|
| + }, {
|
| + 'a|web/test.html._buildLogs.1':
|
| + '[{'
|
| + '"level":"Warning",'
|
| + '"message":"$NO_INITIALIZERS_ERROR"'
|
| + '}]',
|
| + }, [
|
| + 'warning: $NO_INITIALIZERS_ERROR',
|
| + ]);
|
| +
|
| + testPhases('Injects logging element and styles', outputLogsPhases, {
|
| + 'a|web/test.html': '<!DOCTYPE html><html><head>',
|
| + 'a|web/test.html._data': expectedData(['web/a.dart']),
|
| + 'a|web/a.dart':
|
| + 'library a;\n'
|
| + 'import "package:polymer/polymer.dart";\n'
|
| + 'main(){}',
|
| + }, {
|
| + 'a|web/test.html':
|
| + '<!DOCTYPE html><html><head>'
|
| + '<link rel="stylesheet" type="text/css" '
|
| + 'href="packages/polymer/src/build/log_injector.css">'
|
| + '</head><body>'
|
| + '<script type="application/dart" '
|
| + 'src="test.html_bootstrap.dart"></script>'
|
| + '</body></html>',
|
| + 'a|web/test.html_bootstrap.dart':
|
| + '''$MAIN_HEADER
|
| + import 'a.dart' as i0;
|
| + import 'package:polymer/src/build/log_injector.dart';
|
| + ${DEFAULT_IMPORTS.join('\n')}
|
| +
|
| + void main() {
|
| + useGeneratedCode(new StaticConfiguration(
|
| + checkedMode: false));
|
| + new LogInjector().injectLogs();
|
| + configureForDeployment([]);
|
| + i0.main();
|
| + }
|
| + '''.replaceAll('\n ', '\n'),
|
| + 'a|web/a.dart':
|
| + 'library a;\n'
|
| + 'import "package:polymer/polymer.dart";\n'
|
| + 'main(){}',
|
| + });
|
| +}
|
|
|