diff --git a/.gitignore b/.gitignore index c0d4623..5206a3c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # ignore compiled lib files lib/* app/lib/* +built-tests # commit a placeholder to keep the app/lib directory !app/lib/.placeholder diff --git a/.npmignore b/.npmignore index 7d0fb37..58b01ba 100644 --- a/.npmignore +++ b/.npmignore @@ -6,6 +6,10 @@ # ignore src files src +# ignore tests +built-tests +test-resources + # ignore screenshots screenshots diff --git a/gulpfile.babel.js b/gulpfile.babel.js index bc33ee6..4ecce99 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -83,9 +83,18 @@ gulp.task('lint', () => { .pipe(eslint.failAfterError()); }); -gulp.task('test', ['build'], () => { - return gulp.src('test/**/*js', {read: false}) - .pipe(mocha({compilers: 'js:babel-register'})); +gulp.task('build-tests', done => { + return gulp.src(PATHS.TEST_SRC_JS) + .pipe(sourcemaps.init()) + .pipe(babel()) + .on('error', done) + .pipe(sourcemaps.write('.')) + .pipe(gulp.dest(PATHS.TEST_DEST)); +}); + +gulp.task('test', ['build', 'build-tests'], () => { + return gulp.src(PATHS.TEST_DEST_JS, {read: false}) + .pipe(mocha()); }); gulp.task('ci', callback => { @@ -98,7 +107,9 @@ function setUpPaths() { APP_SRC: 'app/src', APP_DEST: 'app/lib', CLI_SRC: 'src', - CLI_DEST: 'lib' + CLI_DEST: 'lib', + TEST_SRC: 'test', + TEST_DEST: 'built-tests' }; paths.APP_MAIN_JS = path.join(paths.APP_SRC, '/main.js'); @@ -107,6 +118,8 @@ function setUpPaths() { paths.APP_STATIC_JS = path.join(paths.APP_SRC, 'static') + '/**/*.js'; paths.APP_STATIC_DEST = path.join(paths.APP_DEST, 'static'); paths.CLI_SRC_JS = paths.CLI_SRC + '/**/*.js'; + paths.TEST_SRC_JS = paths.TEST_SRC + '/**/*.js'; + paths.TEST_DEST_JS = paths.TEST_DEST + '/**/*.js'; return paths; }