From 5a8ccd3e9aef56e57d8173c12cdb98853a06878d Mon Sep 17 00:00:00 2001 From: Walmik Deshpande Date: Tue, 10 Jan 2017 20:26:03 -0800 Subject: [PATCH 1/2] Add karma, jasmine, firefox-launcher --- package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package.json b/package.json index cd11a2f..4d71a31 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,11 @@ "grunt": "^1.0.1", "grunt-contrib-uglify": "^1.0.1", "grunt-contrib-watch": "^1.0.0", + "jasmine": "^2.5.2", + "jasmine-core": "^2.5.2", + "karma": "^1.3.0", + "karma-firefox-launcher": "^1.0.0", + "karma-jasmine": "^1.1.0", "tape": "^4.5.1", "webpack": "^1.13.0" }, From 62e32941e6b2c71baa8bc6caa174b2d5c30bd04d Mon Sep 17 00:00:00 2001 From: Walmik Deshpande Date: Tue, 10 Jan 2017 20:58:48 -0800 Subject: [PATCH 2/2] Basic karma and test setup --- karma.conf.js | 69 ++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +- test/basicTimerSpec.js | 6 ++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 karma.conf.js create mode 100644 test/basicTimerSpec.js diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 0000000..18a5ebb --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,69 @@ +// Karma configuration +// Generated on Tue Jan 10 2017 20:29:02 GMT-0800 (PST) + +module.exports = function(config) { + 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: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'test/*Spec.js' + ], + + + // list of files to exclude + exclude: [ + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // 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_INFO, + + + // 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: ['Firefox'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/package.json b/package.json index 4d71a31..3342eab 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "tape": "./node_modules/.bin/tape -r babel-register ./test/*.js", "test": "npm run eslint && npm run tape", "webpack": "./node_modules/.bin/webpack --watch", - "grunt": "./node_modules/.bin/grunt" + "grunt": "./node_modules/.bin/grunt", + "karma": "./node_modules/.bin/karma" }, "engines": { "node": ">= 0.10.0" diff --git a/test/basicTimerSpec.js b/test/basicTimerSpec.js new file mode 100644 index 0000000..9aaf443 --- /dev/null +++ b/test/basicTimerSpec.js @@ -0,0 +1,6 @@ +describe('test fn', function() { + + it('accepts', function() { + expect(1).toEqual(1); + }) +}); \ No newline at end of file