Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
Use manual compiling of mocha so that sourcemaps can be used
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahaog committed Jan 27, 2016
1 parent dbd660b commit 44efe76
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# ignore src files
src

# ignore tests
built-tests
test-resources

# ignore screenshots
screenshots

Expand Down
21 changes: 17 additions & 4 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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');
Expand All @@ -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;
}

0 comments on commit 44efe76

Please sign in to comment.