OLD | NEW |
1 require('source-map-support').install(); | 1 require('source-map-support').install(); |
2 | 2 |
3 var clangFormat = require('clang-format'); | 3 var clangFormat = require('clang-format'); |
4 var formatter = require('gulp-clang-format'); | 4 var formatter = require('gulp-clang-format'); |
5 var fs = require('fs'); | 5 var fs = require('fs'); |
6 var fsx = require('fs-extra'); | 6 var fsx = require('fs-extra'); |
7 var gulp = require('gulp'); | 7 var gulp = require('gulp'); |
8 var gutil = require('gulp-util'); | 8 var gutil = require('gulp-util'); |
9 var merge = require('merge2'); | 9 var merge = require('merge2'); |
10 var mocha = require('gulp-mocha'); | 10 var mocha = require('gulp-mocha'); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 .pipe(gulp.dest('build/')); // '/test/' comes from base above. | 74 .pipe(gulp.dest('build/')); // '/test/' comes from base above. |
75 }); | 75 }); |
76 | 76 |
77 gulp.task('test.unit', ['test.compile'], function(done) { | 77 gulp.task('test.unit', ['test.compile'], function(done) { |
78 if (hasError) { | 78 if (hasError) { |
79 done(); | 79 done(); |
80 return; | 80 return; |
81 } | 81 } |
82 return gulp.src('build/test/**/*.js').pipe(mocha({ | 82 return gulp.src('build/test/**/*.js').pipe(mocha({ |
83 timeout: 4000, // Needed by the type-based tests :-( | 83 timeout: 4000, // Needed by the type-based tests :-( |
| 84 fullTrace: true, |
84 })); | 85 })); |
85 }); | 86 }); |
86 | 87 |
87 // This test transpiles some unittests to dart and runs them in the Dart VM. | 88 // This test transpiles some unittests to dart and runs them in the Dart VM. |
88 gulp.task('test.e2e', ['test.compile'], function(done) { | 89 gulp.task('test.e2e', ['test.compile'], function(done) { |
89 var testfile = 'helloworld'; | 90 var testfile = 'helloworld'; |
90 | 91 |
91 // Removes backslashes from __dirname in Windows | 92 // Removes backslashes from __dirname in Windows |
92 var dir = (__dirname.replace(/\\/g, '/') + '/build/e2e'); | 93 var dir = (__dirname.replace(/\\/g, '/') + '/build/e2e'); |
93 if (fs.existsSync(dir)) fsx.removeSync(dir); | 94 if (fs.existsSync(dir)) fsx.removeSync(dir); |
94 fs.mkdirSync(dir); | 95 fs.mkdirSync(dir); |
95 fsx.copySync(__dirname + '/test/e2e', dir); | 96 fsx.copySync(__dirname + '/test/e2e', dir); |
96 fsx.copySync(__dirname + '/typings', dir + '/typings'); | 97 fsx.copySync(__dirname + '/typings', dir + '/typings'); |
97 | 98 |
98 // run node with a shell so we can wildcard all the .ts files | 99 // run node with a shell so we can wildcard all the .ts files |
99 var cmd = 'node ../lib/main.js --translateBuiltins --basePath=. --destination=
. ' + | 100 var cmd = 'node ../lib/main.js --translateBuiltins --basePath=. --destination=
. ' + |
100 '--typingsRoot=typings/ ' + | 101 '--typingsRoot=typings/'; |
101 '*.ts angular2/src/facade/lang.d.ts typings/es6-promise/es6-promise.d.ts'; | |
102 // Paths must be relative to our source root, so run with cwd == dir. | 102 // Paths must be relative to our source root, so run with cwd == dir. |
103 spawn('sh', ['-c', cmd], {stdio: 'inherit', cwd: dir}).on('close', function(co
de, signal) { | 103 spawn('sh', ['-c', cmd], {stdio: 'inherit', cwd: dir}).on('close', function(co
de, signal) { |
104 if (code > 0) { | 104 if (code > 0) { |
105 onError(new Error('Failed to transpile ' + testfile + '.ts')); | 105 onError(new Error('Failed to transpile ' + testfile + '.ts')); |
106 } else { | 106 } else { |
107 try { | 107 try { |
108 var opts = {stdio: 'inherit', cwd: dir}; | 108 var opts = {stdio: 'inherit', cwd: dir}; |
109 // Install the unittest packages on every run, using the content of pubs
pec.yaml | 109 // Install the unittest packages on every run, using the content of pubs
pec.yaml |
110 // TODO: maybe this could be memoized or served locally? | 110 // TODO: maybe this could be memoized or served locally? |
111 spawn(which.sync('pub'), ['install'], opts).on('close', function() { | 111 spawn(which.sync('pub'), ['install'], opts).on('close', function() { |
(...skipping 10 matching lines...) Expand all Loading... |
122 | 122 |
123 gulp.task('test', ['test.check-format', 'test.check-lint', 'test.unit', 'test.e2
e']); | 123 gulp.task('test', ['test.check-format', 'test.check-lint', 'test.unit', 'test.e2
e']); |
124 | 124 |
125 gulp.task('watch', ['test.unit'], function() { | 125 gulp.task('watch', ['test.unit'], function() { |
126 failOnError = false; | 126 failOnError = false; |
127 // Avoid watching generated .d.ts in the build (aka output) directory. | 127 // Avoid watching generated .d.ts in the build (aka output) directory. |
128 return gulp.watch(['lib/**/*.ts', 'test/**/*.ts'], {ignoreInitial: true}, ['te
st.unit']); | 128 return gulp.watch(['lib/**/*.ts', 'test/**/*.ts'], {ignoreInitial: true}, ['te
st.unit']); |
129 }); | 129 }); |
130 | 130 |
131 gulp.task('default', ['compile']); | 131 gulp.task('default', ['compile']); |
OLD | NEW |