From 4d0c2ed1f6a1c8b5131a9fc3329d5c951a616952 Mon Sep 17 00:00:00 2001 From: Tim Blasi Date: Tue, 15 Dec 2015 17:11:42 -0800 Subject: [PATCH] test(dart/transform): Update dependencies & fix Dart tests Widen version dependencies for `package:angular`, `package:code_transformers`, and `package:observe`. `package:guinness` uses `package:unittest` while the newest versions of `package:code_transformers` use `package:test`. This causes our end-to-end Dart transformer tests (which use testing code in `package:code_transformers`) to be skipped. To fix this: - Move e2e tests to run in a separate file - Run `gulp test.server.dart` tests serially Closes #5922 Closes #5935 --- modules/angular2/pubspec.yaml | 5 ++- ...client_server_message_bus.server.spec.dart | 19 +++++---- ...client_server_message_bus.server.spec.dart | 17 +++++--- .../transform/transform.e2e.server.spec.dart | 11 +++++ .../test/transform/transform.server.spec.dart | 7 +--- tools/build/run_server_dart_tests.js | 40 +++++++++---------- 6 files changed, 56 insertions(+), 43 deletions(-) create mode 100644 modules_dart/transform/test/transform/transform.e2e.server.spec.dart diff --git a/modules/angular2/pubspec.yaml b/modules/angular2/pubspec.yaml index c595adad83..a5243e3025 100644 --- a/modules/angular2/pubspec.yaml +++ b/modules/angular2/pubspec.yaml @@ -9,7 +9,7 @@ homepage: <%= packageJson.homepage %> environment: sdk: '>=1.10.0 <2.0.0' dependencies: - analyzer: '>=0.24.4 <0.27.0' + analyzer: '>=0.24.4 <0.28.0' barback: '^0.15.2+2' dart_style: '>=0.1.8 <0.3.0' glob: '^1.0.0' @@ -22,8 +22,9 @@ dependencies: source_span: '^1.0.0' stack_trace: '^1.1.1' dev_dependencies: - code_transformers: '0.2.9+4' + code_transformers: '>=0.2.9+4 <0.4.0' guinness: '^0.1.18' + test: '^0.12.6' transformers: - angular2 - $dart2js: diff --git a/modules/angular2/test/web_workers/debug_tools/multi_client_server_message_bus.server.spec.dart b/modules/angular2/test/web_workers/debug_tools/multi_client_server_message_bus.server.spec.dart index 857b948b0b..5997d2cade 100644 --- a/modules/angular2/test/web_workers/debug_tools/multi_client_server_message_bus.server.spec.dart +++ b/modules/angular2/test/web_workers/debug_tools/multi_client_server_message_bus.server.spec.dart @@ -5,15 +5,17 @@ import "dart:async"; import "package:angular2/testing_internal.dart" show AsyncTestCompleter, - inject, - describe, - it, - iit, - expect, + SpyObject, beforeEach, beforeEachProviders, - SpyObject, - proxy; + describe, + expect, + iit, + inject, + it, + proxy, + testSetup; +import 'package:angular2/src/platform/server/html_adapter.dart'; import "package:angular2/src/web_workers/debug_tools/multi_client_server_message_bus.dart"; import "package:angular2/src/web_workers/shared/messaging_api.dart"; import "./message_bus_common.dart"; @@ -22,6 +24,9 @@ import "dart:convert" show JSON; import 'dart:math'; main() { + Html5LibDomAdapter.makeCurrent(); + testSetup(); + List messageHistory = new List(); List resultMarkers = new List(); describe("MultiClientServerMessageBusSink", () { diff --git a/modules/angular2/test/web_workers/debug_tools/single_client_server_message_bus.server.spec.dart b/modules/angular2/test/web_workers/debug_tools/single_client_server_message_bus.server.spec.dart index 50ca5f15ae..e941cda9f0 100644 --- a/modules/angular2/test/web_workers/debug_tools/single_client_server_message_bus.server.spec.dart +++ b/modules/angular2/test/web_workers/debug_tools/single_client_server_message_bus.server.spec.dart @@ -5,20 +5,25 @@ import "dart:async"; import "package:angular2/testing_internal.dart" show AsyncTestCompleter, - inject, - describe, - it, - expect, + SpyObject, beforeEach, beforeEachProviders, - SpyObject, - proxy; + describe, + expect, + inject, + it, + proxy, + testSetup; +import 'package:angular2/src/platform/server/html_adapter.dart'; import "package:angular2/src/web_workers/debug_tools/single_client_server_message_bus.dart"; import "./message_bus_common.dart"; import "./spy_web_socket.dart"; import "dart:convert" show JSON; main() { + Html5LibDomAdapter.makeCurrent(); + testSetup(); + var MESSAGE = const {'test': 10}; const CHANNEL = "TEST_CHANNEL"; describe("SingleClientServerMessageBusSink", () { diff --git a/modules_dart/transform/test/transform/transform.e2e.server.spec.dart b/modules_dart/transform/test/transform/transform.e2e.server.spec.dart new file mode 100644 index 0000000000..1e0d4482ad --- /dev/null +++ b/modules_dart/transform/test/transform/transform.e2e.server.spec.dart @@ -0,0 +1,11 @@ +library angular2.test.transform.transform.e2e.spec; + +import 'package:test/test.dart'; + +import 'inliner_for_test/all_tests.dart' as inliner; +import 'integration/all_tests.dart' as integration; + +main() { + group('Inliner For Test e2e', inliner.endToEndTests); + group('Transformer Pipeline', integration.allTests); +} diff --git a/modules_dart/transform/test/transform/transform.server.spec.dart b/modules_dart/transform/test/transform/transform.server.spec.dart index d3fe7a54e1..b27b063b81 100644 --- a/modules_dart/transform/test/transform/transform.server.spec.dart +++ b/modules_dart/transform/test/transform/transform.server.spec.dart @@ -1,4 +1,4 @@ -library angular2.test.transform; +library angular2.test.transform.transform.server.spec; import 'package:guinness/guinness.dart'; import 'package:unittest/unittest.dart' hide expect; @@ -12,7 +12,6 @@ import 'deferred_rewriter/all_tests.dart' as deferredRewriter; import 'directive_metadata_linker/all_tests.dart' as directiveMeta; import 'directive_processor/all_tests.dart' as directiveProcessor; import 'inliner_for_test/all_tests.dart' as inliner; -import 'integration/all_tests.dart' as integration; import 'reflection_remover/all_tests.dart' as reflectionRemover; import 'template_compiler/all_tests.dart' as templateCompiler; import 'stylesheet_compiler/all_tests.dart' as stylesheetCompiler; @@ -30,8 +29,4 @@ main() { describe('Deferred Rewriter', deferredRewriter.allTests); describe('Stylesheet Compiler', stylesheetCompiler.allTests); describe('Url Resolver', urlResolver.allTests); - // NOTE(kegluneq): These use `code_transformers#testPhases`, which is not - // designed to work with `guinness`. - group('Inliner For Test e2e', inliner.endToEndTests); - group('Transformer Pipeline', integration.allTests); } diff --git a/tools/build/run_server_dart_tests.js b/tools/build/run_server_dart_tests.js index 09949ede54..af17bc6317 100644 --- a/tools/build/run_server_dart_tests.js +++ b/tools/build/run_server_dart_tests.js @@ -16,38 +16,34 @@ module.exports = function(gulp, plugins, config) { }; function run(dir) { - var testDir = path.join(dir, 'test'); - var relativeMasterTestFile = 'test/_all_tests.dart'; var testFiles = [].slice.call(glob.sync('**/*.server.spec.dart', { - cwd: testDir + cwd: dir })); if (testFiles.length == 0) { // No test files found return Q.resolve(); } - var header = ['library _all_tests;', 'import "package:angular2/testing.dart";', '']; - var main = ['main() {']; - main.push(' setBaseTestProviders([], []);'); - testFiles.forEach(function(fileName, index) { - header.push('import "' + fileName + '" as test_' + index + ';'); - main.push(' test_' + index + '.main();'); - }); - header.push(''); - main.push('}'); - - var absMasterTestFile = path.join(dir, relativeMasterTestFile); - fs.writeFileSync(absMasterTestFile, header.concat(main).join('\n')); var defer = Q.defer(); var done = defer.makeNodeResolver(); console.log('start tests:', dir); - util.processToPromise(spawn('dart', ['-c', relativeMasterTestFile], { - stdio: 'inherit', - cwd: dir - })).then( - function() { done(); }, - function(error) { done(error); } - ); + var processSerial = function() { + if (testFiles.length == 0) { + done(); + return; + } + var file = testFiles.shift(); + util.processToPromise(spawn('dart', ['-c', file], { + stdio: 'inherit', + cwd: dir + })).then( + processSerial, + function(error) { + done(error); + } + ); + }; + processSerial(); return defer.promise.then(function() { console.log('end tests'); });