This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54c5736
commit 088c42c
Showing
4 changed files
with
1,177 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Karma configuration | ||
if (!process.env.NODE_ENV) { | ||
process.env.NODE_ENV = 'test'; | ||
} | ||
|
||
module.exports = function (config) { | ||
const tests = './client/**/__tests__/*.spec.js'; | ||
|
||
config.set({ | ||
|
||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: '../', | ||
|
||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['ava'], | ||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
tests | ||
], | ||
|
||
// test results reporter to use | ||
// possible values: 'dots', 'progress' | ||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter | ||
// reporters: ['spec'], | ||
|
||
// web server port | ||
port: 9876, | ||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_DEBUG, | ||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
|
||
// start these browsers | ||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | ||
browsers: ['PhantomJS'], | ||
|
||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: false, | ||
|
||
// Concurrency level | ||
// how many browser should be started simultaneous | ||
concurrency: Infinity, | ||
|
||
// Ensure Karma doesn't use an iFrame. | ||
client: { | ||
useIframe: false | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
const gulp = require('gulp'); | ||
const ava = require('gulp-ava'); | ||
const gutil = require('gulp-util'); | ||
const { Server } = require('karma'); | ||
|
||
gulp.task('test', ['test:unit']); | ||
|
||
gulp.task('test:unit', () => { | ||
gulp.task('test:unit', done => { | ||
process.env.BABEL_ENV = 'test'; | ||
|
||
return gulp.src('../client/**/__tests__/*.spec.js') | ||
.pipe(ava({ verbose: true })); | ||
const server = new Server({ | ||
configFile: __dirname + '/karma.conf.js', | ||
singleRun: true | ||
}, () => { | ||
gutil.log('Tests complete'); | ||
|
||
done(); | ||
}); | ||
|
||
server.start(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.