Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

test: Setting up test framework for JS unit tests #1

Merged
merged 1 commit into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: google
parser: babel-eslint
rules:
strict: 0
require-jsdoc: off
valid-jsdoc: off
switch-colon-spacing: 0
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage
node_modules
.DS_Store
110 changes: 110 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Karma configuration
// Generated on Tue Mar 06 2018 14:20:28 GMT-0800 (PST)
const path = require('path');

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: ['mocha'],


// list of files / patterns to load in the browser
files: [
'test/unit/index.js'
],


// list of files / patterns to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/unit/index.js': ['webpack']
},

webpack: {
devtool: 'inline-source-map',
module: {
loaders: [
{ test: /\.js?$/, loader: 'babel-loader' }
],
rules: [
// instrument only testing sources with Istanbul
{
test: /\.js$/,
use: {
loader: 'istanbul-instrumenter-loader',
options: {esModules: true}
},
include: path.resolve('packages/'),
exclude: [
/node_modules/
],
enforce: 'post'
}
]
}
},

client: {
mocha: {
reporter: 'html',
ui: 'qunit',
},
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],

coverageReporter: {
dir: 'coverage',
reporters: [
{type: 'lcovonly', subdir: '.'},
{type: 'json', subdir: '.', file: 'coverage.json'},
{type: 'html'},
],
},


// 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: false,


// 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,
})
}
Loading