Skip to content

Commit

Permalink
Test userland assert and Node.js core assert
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Apr 17, 2019
1 parent fc589c5 commit 00dc6d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ language: node_js
matrix:
include:
- node_js: 'stable'
env: TASK=test
- node_js: 'node'
env: VERSION=v12.0.0-rc.1
env: TASK=test VERSION=v12.0.0-rc.1
before_install: NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/rc nvm install $VERSION
script: npm test
- node_js: 'stable'
env: TASK=test-native
- node_js: 'node'
env: TASK=test-native VERSION=v12.0.0-rc.1
before_install: NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/rc nvm install $VERSION
script: npm run $TASK
notifications:
email:
on_success: never
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
"homepage": "https://github.com/browserify/commonjs-assert",
"repository": "browserify/commonjs-assert",
"scripts": {
"test": "node test.js"
"test": "node test.js",
"test-native": "cross-env TEST_NATIVE=true npm test"
},
"keywords": [
"assert",
"browser"
],
"devDependencies": {
"cross-env": "^5.2.0",
"glob": "^7.1.3",
"proxyquire": "^2.1.0",
"tape": "^4.10.1"
}
}
5 changes: 4 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
const test = require('tape');
const glob = require('glob');
const path = require('path');
const proxyquire = require('proxyquire');

const assert = require(process.env.TEST_NATIVE === 'true' ? 'assert' : '.');

const testPaths = glob.sync('test/**/test-assert*.js');

testPaths.forEach(testPath => {
test(testPath, t => {
t.doesNotThrow(() => {
require(path.resolve(__dirname, testPath));
proxyquire(path.resolve(__dirname, testPath), {assert});
});
t.end();
});
Expand Down

0 comments on commit 00dc6d5

Please sign in to comment.