diff options
Diffstat (limited to 'tests/lib/mocha-3.1.0/scripts/dedefine.js')
-rw-r--r-- | tests/lib/mocha-3.1.0/scripts/dedefine.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.0/scripts/dedefine.js b/tests/lib/mocha-3.1.0/scripts/dedefine.js new file mode 100644 index 0000000000..c647c0e083 --- /dev/null +++ b/tests/lib/mocha-3.1.0/scripts/dedefine.js @@ -0,0 +1,26 @@ +'use strict'; + +/** + * This is a transform stream we're using to strip AMD calls from + * dependencies in our Browserify bundle. + */ + +var through = require('through2'); +var defineRx = /typeof define === ['"]function['"] && define\.amd/g; + +function createStream() { + return through.obj(function(chunk, enc, next) { + this.push(String(chunk) + .replace(defineRx, 'false')); + next(); + }); +} + +module.exports = function(b) { + function wrap() { + b.pipeline.get('wrap').push(createStream()); + } + + b.on('reset', wrap); + wrap(); +}; |