Skip to content

Commit

Permalink
fix missing index.mjs; use better smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed May 28, 2020
1 parent b45e3a1 commit 71e262d
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ jobs:
stage: smoke
env: null
before_install: true
install: npm install --production
install: false
name: 'Latest Node.js'
script: ./bin/mocha --no-config --reporter spec test/smoke/smoke.spec.js
script: |
TARBALL=$(npm pack) && \
mkdir -p /tmp/mocha-smoke && \
cp -r test/smoke /tmp/mocha-smoke && \
cd /tmp/mocha-smoke && \
npm install ~1/$TARBALL && \
node_modules/.bin/mocha --no-config ./smoke
cache:
directories:
- ~/.npm
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@
"index.js",
"mocha.css",
"mocha.js",
"browser-entry.js"
"browser-entry.js",
"index.mjs"
],
"browserify": {
"transform": [
Expand Down
18 changes: 18 additions & 0 deletions test/smoke/smoke-cjs.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

// This test ensures Mocha's dependencies are properly in place,
// and is intended to be run after an `npm install --production` in a clean
// working copy. It helps avoid publishing Mocha with `dependencies`
// in `devDependencies` or otherwise in the wrong place.
// It does not ensure that all files are present in the published package!

var assert = require('assert');
var mocha = require('mocha');
var describe = mocha.describe;
var it = mocha.it;

describe('a production installation of Mocha via CJS', function() {
it('should be able to execute a test', function() {
assert.ok(true);
});
});
14 changes: 14 additions & 0 deletions test/smoke/smoke-esm.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This test ensures Mocha's dependencies are properly in place,
// and is intended to be run after an `npm install --production` in a clean
// working copy. It helps avoid publishing Mocha with `dependencies`
// in `devDependencies` or otherwise in the wrong place.
// It does not ensure that all files are present in the published package!

import assert from 'assert';
import {describe, it} from 'mocha';

describe('a production installation of Mocha via ESM', function() {
it('should be able to execute a test', function() {
assert.ok(true);
});
});
15 changes: 15 additions & 0 deletions test/smoke/smoke-globals.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

// This test ensures Mocha's dependencies are properly in place,
// and is intended to be run after an `npm install --production` in a clean
// working copy. It helps avoid publishing Mocha with `dependencies`
// in `devDependencies` or otherwise in the wrong place.
// It does not ensure that all files are present in the published package!

var assert = require('assert');

describe('a production installation of Mocha via globals', function() {
it('should be able to execute a test', function() {
assert.ok(true);
});
});

0 comments on commit 71e262d

Please sign in to comment.