js-peer-id/karma.conf.js

62 lines
1.2 KiB
JavaScript
Raw Normal View History

module.exports = (config) => {
const path = require('path')
const node_modules_dir = path.join(__dirname, 'node_modules')
const deps = [
2016-02-10 13:55:59 -08:00
'deps/forge.bundle.js'
]
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
2016-02-12 14:55:05 -08:00
'tests/test.js'
2016-02-10 13:55:59 -08:00
],
preprocessors: {
2016-02-12 14:55:05 -08:00
'tests/*': ['webpack']
2016-02-10 13:55:59 -08:00
},
webpack: {
2016-03-03 14:19:10 -08:00
output: {
2016-03-05 21:54:18 +00:00
path: path.join(__dirname, 'dist'),
2016-03-03 14:19:10 -08:00
filename: 'bundle.js'
},
2016-02-10 13:55:59 -08:00
resolve: {
extensions: ['', '.js', '.json'],
alias: { 'node-forge': path.resolve(__dirname, 'deps/forge.bundle.js') }
2016-02-10 13:55:59 -08:00
},
externals: {
fs: '{}'
},
node: {
Buffer: true
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json' }
],
noParse: []
2016-02-12 16:13:09 -08:00
}
2016-02-10 13:55:59 -08:00
},
webpackMiddleware: {
noInfo: true,
stats: {
colors: true
}
},
reporters: ['spec'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'],
singleRun: true
})
deps.forEach((dep) => {
const depPath = path.resolve(node_modules_dir, dep)
2016-02-10 13:55:59 -08:00
config.webpack.module.noParse.push(depPath)
})
}