Skip to content

armgit / mocha

Public Imported from GitHub
0

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

extract checking AMD bundle as own test

Outsiderf4275b67c0c4
diff --git a/package-scripts.js b/package-scripts.js
index 7aa256d2..aee5463d 100644
--- a/package-scripts.js
+++ b/package-scripts.js
@@ -40,7 +40,7 @@ module.exports = {
test: {
default: 'nps test.all',
all: {
- script: 'nps lint.code test.node test.browser',
+ script: 'nps lint.code test.node test.browser test.bundle',
description: 'Lint code and runs node / browser environment tests'
},
node: {
@@ -205,6 +205,17 @@ module.exports = {
script: test('non-tty-dot', '--reporter spec test/interfaces/bdd.spec 2>&1 > /tmp/spec.out && echo "spec:" && cat /tmp/spec.out'),
description: 'Test non-TTY spec reporter'
}
+ },
+ bundle: {
+ default: 'nps test.bundle.all',
+ all: {
+ script: 'nps clean build.mochajs test.bundle.amd',
+ description: 'Compile Mocha and run all tests for bundle files'
+ },
+ amd: {
+ script: test('amd', 'test/bundle/amd.spec'),
+ description: 'Test bundle files for AMD'
+ }
}
},
coveralls: {
diff --git a/scripts/travis-before-script.sh b/scripts/travis-before-script.sh
index 19ebc4b1..3e8a45c0 100755
--- a/scripts/travis-before-script.sh
+++ b/scripts/travis-before-script.sh
@@ -2,6 +2,3 @@
# bundle artifacts to AWS go here
mkdir -p .karma
-
-# ensure we are building a non-broken bundle for AMD
-npm start build.mochajs && [[ -z "$(grep 'define.amd' mocha.js)" ]] || exit 1
diff --git a/test/bundle/amd.spec.js b/test/bundle/amd.spec.js
new file mode 100644
index 00000000..e42d3dab
--- /dev/null
+++ b/test/bundle/amd.spec.js
@@ -0,0 +1,14 @@
+'use strict';
+
+var path = require('path');
+var fs = require('fs');
+
+it('should build a non-broken bundle for AMD', function (done) {
+ var bundle = path.join(process.cwd(), 'mocha.js');
+ fs.readFile(bundle, 'utf8', function (err, content) {
+ if (err) { return done(err); }
+
+ expect(content).not.to.match(/define.amd/);
+ done();
+ });
+});