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
This commit is contained in:
Tim Blasi 2015-12-15 17:11:42 -08:00 committed by Timothy Blasi
parent eda6a5d52a
commit 4d0c2ed1f6
6 changed files with 56 additions and 43 deletions

View File

@ -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:

View File

@ -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<String> messageHistory = new List<String>();
List<int> resultMarkers = new List<int>();
describe("MultiClientServerMessageBusSink", () {

View File

@ -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", () {

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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');
});