Skip to content

Commit

Permalink
feat(build): improve testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mgechev committed Aug 21, 2016
1 parent 55c7359 commit eece3e1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
5 changes: 3 additions & 2 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ gulp.task('build.test', (done: any) =>

// --------------
// Build test watch.
gulp.task('build.test.watch', (done: any) =>
gulp.task('test.watch', (done: any) =>
runSequence('build.test',
'watch.test',
'karma.watch',
done));

// --------------
Expand Down Expand Up @@ -116,7 +117,7 @@ gulp.task('serve.prod', (done: any) =>
// Test.
gulp.task('test', (done: any) =>
runSequence('build.test',
'karma.start',
'karma.run',
done));

// --------------
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build.e2e": "gulp build.e2e --color",
"build.prod": "gulp build.prod --color --config-env prod",
"build.test": "gulp build.test --color",
"build.test.watch": "gulp build.test.watch --color",
"test.watch": "gulp test.watch --color",
"generate.manifest": "gulp generate.manifest --color",
"e2e": "protractor",
"e2e.live": "protractor --elementExplorer",
Expand Down
7 changes: 7 additions & 0 deletions tools/tasks/seed/karma.run.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { startKarma } from '../../utils/seed/karma.start';
/**
* Executes the build process, running all unit tests using `karma`.
*/
export = (done: any) => {
return startKarma(done);
};
12 changes: 0 additions & 12 deletions tools/tasks/seed/karma.start.ts

This file was deleted.

9 changes: 9 additions & 0 deletions tools/tasks/seed/karma.watch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { startKarma } from '../../utils/seed/karma.start';
/**
* Executes the build process, running all unit tests using `karma`.
*/
export = (done: any) => {
return startKarma(done, {
singleRun: false
});
};
10 changes: 10 additions & 0 deletions tools/utils/seed/karma.start.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as karma from 'karma';
import { join } from 'path';

export const startKarma = (done: any, config: any = {}) => {
return new (<any>karma).Server(Object.assign({
configFile: join(process.cwd(), 'karma.conf.js'),
singleRun: true
}, config)).start(done);
};

0 comments on commit eece3e1

Please sign in to comment.