Last active
December 21, 2018 02:21
-
-
Save koba04/7a18677b583e1ec43fca to your computer and use it in GitHub Desktop.
karma + mocha + browserify + babel + power-assert
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
node_modules/ |
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
// Karma configuration | |
// Generated on Thu Apr 07 2016 10:06:49 GMT+0900 (JST) | |
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: ['browserify', 'mocha'], | |
browserify: { | |
debug: true, | |
transform: [ | |
['babelify', {plugins: ['babel-plugin-espower']}] | |
] | |
}, | |
// list of files / patterns to load in the browser | |
files: [ | |
'*-test.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.js': 'browserify' | |
}, | |
// 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: ['Chrome'], | |
// 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 | |
}) | |
} |
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
{ | |
"name": "karma-conf", | |
"version": "1.0.0", | |
"description": "", | |
"main": "karma.conf.js", | |
"scripts": { | |
"test": "karma start" | |
}, | |
"browserify": { | |
"transform": [ | |
[ | |
"babelify", | |
{ | |
"presets": [ | |
"es2015" | |
] | |
} | |
] | |
] | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git+https://gist.github.com/7a18677b583e1ec43fca.git" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"bugs": { | |
"url": "https://gist.github.com/7a18677b583e1ec43fca" | |
}, | |
"homepage": "https://gist.github.com/7a18677b583e1ec43fca", | |
"devDependencies": { | |
"babel-plugin-espower": "^2.1.2", | |
"babel-preset-es2015": "^6.6.0", | |
"babelify": "^7.2.0", | |
"browserify": "^13.0.0", | |
"karma": "^0.13.22", | |
"karma-browserify": "^5.0.3", | |
"karma-chrome-launcher": "^0.2.3", | |
"karma-mocha": "^0.2.2", | |
"mocha": "^2.4.5", | |
"power-assert": "^1.3.1", | |
"watchify": "^3.7.0" | |
} | |
} |
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
import assert from 'power-assert'; | |
import sum from './sum'; | |
describe("sum", () => { | |
it("2 + 2 = 5", () => { | |
assert(sum(2, 2) === 5); | |
}); | |
}); |
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
export default function sum(a, b) { | |
return a + b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I didn't notice your comments because gist doesn't have any notifications...
Anyway, I've updated my karma.conf.js and Added all files including
package.json
😄