Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
extract checking AMD bundle as own test
Browse files Browse the repository at this point in the history
  • Loading branch information
outsideris authored and boneskull committed Mar 21, 2018
1 parent 17fa193 commit eac4dba
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
13 changes: 12 additions & 1 deletion package-scripts.js
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down
3 changes: 0 additions & 3 deletions scripts/travis-before-script.sh
Expand Up @@ -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
14 changes: 14 additions & 0 deletions 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();
});
});

0 comments on commit eac4dba

Please sign in to comment.