Skip to content

Instantly share code, notes, and snippets.

@upalexgill
Created July 21, 2020 10:31
Show Gist options
  • Select an option

  • Save upalexgill/49779c38c09817cf08bc1006ce1aa27f to your computer and use it in GitHub Desktop.

Select an option

Save upalexgill/49779c38c09817cf08bc1006ce1aa27f to your computer and use it in GitHub Desktop.
Karma config
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai', 'commonjs'],
files: [
'test/**/*.+(spec|test).+(js|jsx|mjs)',
{ pattern: 'test/**/*', included: false, served: true }
],
browsers: ['Chrome'],
plugins: [
'karma-*'
],
preprocessors: {
'test/**/*.+(spec|test).+(js|jsx|mjs)': ['commonjs']
},
client: {
clearContext: false
},
reporters: ['spec', 'html']
})
}
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "karma start karma.conf.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"chai": "^4.2.0",
"karma": "^5.1.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-commonjs": "^1.0.0",
"karma-html-reporter": "^0.2.7",
"karma-mocha": "^2.0.1",
"karma-requirejs": "^1.1.0",
"karma-spec-reporter": "0.0.32",
"mocha": "^8.0.1",
"requirejs": "^2.3.6"
}
}
describe('Array', function () {
describe('#indexOf()', function () {
it('should return -1 when the value is not present', function () {
assert.equal([1, 2, 3].indexOf(4), -1)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment