feat(build): add `test.unit.dartvm` for a faster roundtrip of dartvm tests

This commit is contained in:
Tobias Bosch 2015-06-05 11:06:24 -07:00
parent 529805508a
commit 46eeee6b5e
2 changed files with 69 additions and 36 deletions

View File

@ -497,6 +497,33 @@ gulp.task('test.unit.cjs', ['build/clean.js', 'build.tools'], function (neverDon
}); });
gulp.task('test.unit.dartvm', function (done) {
runSequence(
'build/tree.dart',
'build/pubspec.dart',
'!build/change_detect.dart',
'!test.unit.dartvm/run',
function(error) {
// if initial build failed (likely due to build or formatting step) then exit
// otherwise karma server doesn't start and we can't continue running properly
if (error) {
done(error);
return;
}
watch('modules/angular2/**', { ignoreInitial: true }, [
'!build/tree.dart',
'!test.unit.dartvm/run'
]);
}
);
});
gulp.task('!test.unit.dartvm/run', runServerDartTests(gulp, gulpPlugins, {
dir: 'dist/dart/angular2'
}));
gulp.task('test.unit.tools/ci', function(done) { gulp.task('test.unit.tools/ci', function(done) {
runJasmineTests(['dist/tools/**/*.spec.js', 'tools/**/*.spec.js'], done); runJasmineTests(['dist/tools/**/*.spec.js', 'tools/**/*.spec.js'], done);
}); });

View File

@ -8,9 +8,14 @@ var util = require('./util');
module.exports = function(gulp, plugins, config) { module.exports = function(gulp, plugins, config) {
return function() { return function() {
return util.forEachSubDirSequential( if (config.dir) {
config.dest, return run(config.dir);
function(dir) { } else {
return util.forEachSubDirSequential(config.dest, run);
}
};
function run(dir) {
var testDir = path.join(dir, 'test'); var testDir = path.join(dir, 'test');
var relativeMasterTestFile = 'test/_all_tests.dart'; var relativeMasterTestFile = 'test/_all_tests.dart';
var testFiles = [].slice.call(glob.sync('**/*.server.spec.dart', { var testFiles = [].slice.call(glob.sync('**/*.server.spec.dart', {
@ -34,6 +39,7 @@ module.exports = function(gulp, plugins, config) {
var defer = Q.defer(); var defer = Q.defer();
var done = defer.makeNodeResolver(); var done = defer.makeNodeResolver();
console.log('start tests');
util.processToPromise(spawn('dart', ['-c', relativeMasterTestFile], { util.processToPromise(spawn('dart', ['-c', relativeMasterTestFile], {
stdio: 'inherit', stdio: 'inherit',
cwd: dir cwd: dir
@ -41,8 +47,8 @@ module.exports = function(gulp, plugins, config) {
function() { done(); }, function() { done(); },
function(error) { done(error); } function(error) { done(error); }
); );
return defer.promise; return defer.promise.then(function() {
console.log('end tests');
});
} }
);
};
}; };