Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: pkg/polymer/test/build/linter_test.dart

Issue 427623002: Polymer transformer logs now show on the frontend for pub serve. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: added tests for the log widget Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/test/build/linter_test.dart
diff --git a/pkg/polymer/test/build/linter_test.dart b/pkg/polymer/test/build/linter_test.dart
index 3bff05c36b7df6a0ae1d8144272397947fc2f264..eb0789aea6f8ae756a34957653f331c3455aa5b8 100644
--- a/pkg/polymer/test/build/linter_test.dart
+++ b/pkg/polymer/test/build/linter_test.dart
@@ -4,6 +4,8 @@
library polymer.test.linter_test;
+import 'dart:convert';
+
import 'package:polymer/src/build/common.dart';
import 'package:polymer/src/build/linter.dart';
import 'package:unittest/unittest.dart';
@@ -292,7 +294,8 @@ void main() {
</polymer-element>
</html>'''.replaceAll(' ', ''),
}, [
- 'error: Nested polymer element definitions are not allowed.'
+ // We are wrapping this and converting to a warning.
Siggi Cherem (dart-lang) 2014/08/05 19:37:21 yeah, same here - I'm inclined to do that for all
jakemac 2014/08/05 22:58:23 Done.
+ 'warning: Nested polymer element definitions are not allowed.'
' (lib/test.html 4 4)'
]);
@@ -307,7 +310,8 @@ void main() {
</polymer-element>
</html>'''.replaceAll(' ', ''),
}, [
- 'error: $NO_IMPORT_WITHIN_ELEMENT (lib/test.html 3 2)'
+ // We are wrapping this and converting to a warning.
+ 'warning: $NO_IMPORT_WITHIN_ELEMENT (lib/test.html 3 2)'
]);
_testLinter('need a name for <polymer-element>', {
@@ -316,7 +320,8 @@ void main() {
<polymer-element></polymer-element>
</html>'''.replaceAll(' ', ''),
}, [
- 'error: Missing tag name of the custom element. Please include an '
+ // We are wrapping this and converting to a warning.
+ 'warning: Missing tag name of the custom element. Please include an '
'attribute like \'name="your-tag-name"\'. (lib/test.html 2 0)'
]);
@@ -326,7 +331,8 @@ void main() {
<polymer-element name="a"></polymer-element>
</html>'''.replaceAll(' ', ''),
}, [
- 'error: Invalid name "a". Custom element names must have at least one'
+ // We are wrapping this and converting to a warning.
+ 'warning: Invalid name "a". Custom element names must have at least one'
' dash and can\'t be any of the following names: annotation-xml, '
'color-profile, font-face, font-face-src, font-face-uri, '
'font-face-format, font-face-name, missing-glyph. (lib/test.html 2 0)'
@@ -645,6 +651,34 @@ void main() {
</svg>
'''.replaceAll(' ', ''),
}, []);
+
+ group('output logs to file', () {
+ final outputLogsPhases = [[new Linter(
+ new TransformOptions(injectBuildLogsInOutput: true))]];
+
+ testPhases("logs are output to file", outputLogsPhases, {
+ 'a|web/test.html': '<!DOCTYPE html><html>\n'
+ '<polymer-element name="x-a"></polymer-element>'
+ '<script type="application/dart" src="foo.dart">'
+ '</script>'
+ '<script src="packages/browser/dart.js"></script>'
+ '</html>',
+ }, {
+ 'a|web/test.html._buildLogs.1':
+ '[{'
+ '"level":"Warning",'
+ '"message":${JSON.encode(usePolymerHtmlMessage(0))},'
+ '"span":{'
+ '"location":"web/test.html:2:1",'
+ '"text":'
+ '"${new HtmlEscape().convert('<polymer-element name="x-a">')}"'
+ '}'
+ '}]',
+ }, [
+ // Logs should still make it to barback too.
+ 'warning: ${usePolymerHtmlMessage(0)} (web/test.html 1 0)',
+ ]);
+ });
}
_testLinter(String name, Map inputFiles, List outputMessages,

Powered by Google App Engine
This is Rietveld 408576698