-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for running bson tests in the browser via Karma. Fixes NODE-1504
- Loading branch information
1 parent
3620ef8
commit 223fbdf
Showing
22 changed files
with
5,621 additions
and
1,443 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
const scenariosPlugin = require('./tools/scenarios-plugin'); | ||
const jsonPlugin = require('rollup-plugin-json'); | ||
const nodeGlobals = require('rollup-plugin-node-globals'); | ||
const nodeBuiltins = require('rollup-plugin-node-builtins'); | ||
const commonjs = require('rollup-plugin-commonjs'); | ||
const nodeResolve = require('rollup-plugin-node-resolve'); | ||
|
||
const rollupPlugins = [ | ||
scenariosPlugin(), | ||
nodeResolve({ | ||
browser: true, | ||
preferBuiltins: false | ||
}), | ||
commonjs({ | ||
namedExports: { | ||
'node_modules/buffer/index.js': ['isBuffer'] | ||
} | ||
}), | ||
nodeBuiltins(), | ||
nodeGlobals(), | ||
jsonPlugin() | ||
]; | ||
|
||
const rollupConfig = { | ||
plugins: rollupPlugins, | ||
output: { | ||
format: 'iife', | ||
name: 'BSONtest', | ||
exports: 'named' | ||
} | ||
}; | ||
|
||
const onwarn = warning => { | ||
if (warning.code === 'CIRCULAR_DEPENDENCY' || warning.code === 'EVAL') return; | ||
console.warn(warning.toString()); | ||
}; | ||
|
||
rollupConfig.onwarn = onwarn; | ||
|
||
// Karma configuration | ||
// Generated on Thu Jun 28 2018 14:24:01 GMT-0400 (EDT) | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
basePath: '', | ||
frameworks: ['mocha'], | ||
reporters: ['mocha'], | ||
files: [{ pattern: 'test/node/!(bson_node_only_test).js', watched: false }], | ||
preprocessors: { | ||
'test/node/!(bson_node_only_test).js': 'rollup' | ||
}, | ||
rollupPreprocessor: rollupConfig, | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: ['ChromeHeadless'], | ||
singleRun: true, | ||
concurrency: Infinity | ||
}); | ||
}; |
Oops, something went wrong.