Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

fix AMD bundle by hacking around check in `he` module; closes #3000

Christopher Hiller9a3ddebdb5b2
diff --git a/scripts/dedefine.js b/scripts/dedefine.js
index 3e297586..850fde38 100644
--- a/scripts/dedefine.js
+++ b/scripts/dedefine.js
@@ -6,8 +6,7 @@
*/
var through = require('through2');
-var defineRx = /typeof define === ['"]function['"] && define\.amd/g;
-
+var defineRx = /typeof\s+define\s*===?\s*['"]function['"]\s*&&\s*(?:define\.amd|typeof\s+define\.amd\s*===?\s*['"]object['"]\s*&&\s*define\.amd)/g;
function createStream () {
return through.obj(function (chunk, enc, next) {
this.push(String(chunk)
diff --git a/scripts/travis-before-script.sh b/scripts/travis-before-script.sh
index 3e8a45c0..f636a88a 100755
--- a/scripts/travis-before-script.sh
+++ b/scripts/travis-before-script.sh
@@ -2,3 +2,6 @@
# bundle artifacts to AWS go here
mkdir -p .karma
+
+# ensure we are building a non-broken bundle for AMD
+make BUILDTMP/mocha.js && [[ -z "$(grep 'define.amd' BUILDTMP/mocha.js)" ]] || exit 1