-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Several changes to the test suite to support running tests in parallel, bringing the overall test time down considerably. - Replace all literal 1337 and 1234 ports with a custom per-process port assignment based on the TAP_CHILD_ID environment variable. - Add common.pkg as a per-test working directory instead of polluting __dirname or accidentally reusing the same working directory for multiple tests. - Rework test config handling so that tests don't rely on config setup being run in a particular order. - Remove the npm-registry-couchapp tests, since it (a) relies on CouchDB, (b) is no longer a reliable indicator of registry compatibility, and (c) is already superceded in most cases by tests that use npm-registry-mock. (A test suite that runs against a reference implementation is a thing that should exist, but not here.) - Remove the fake-registry logging when TAP_CHILD_ID is set, since this is extremely hard to make sense of when running multiple tests in parallel. When Node v6 compatibility is dropped in npm v7, we can upgrade to the latest version of tap for a bit more speed, dropping Domains (and the associated deprecation warnings), and a fancier test reporter.
- Loading branch information
Showing
266 changed files
with
553 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ npm-debug.log | |
.jshintrc | ||
.eslintrc | ||
.nyc_output | ||
/test/npm_cache* | ||
/node_modules/.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
if (module === require.main) { | ||
console.log('1..1') | ||
console.log('ok 1 setup done') | ||
process.exit(0) | ||
} | ||
|
||
var fs = require('graceful-fs') | ||
var path = require('path') | ||
var userconfigSrc = path.resolve(__dirname, 'fixtures', 'config', 'userconfig') | ||
exports.userconfig = userconfigSrc + '-with-gc' | ||
exports.globalconfig = path.resolve(__dirname, 'fixtures', 'config', 'globalconfig') | ||
|
||
// if this hasn't been written yet, then do it now. | ||
try { | ||
fs.statSync(exports.userconfig) | ||
} catch (er) { | ||
var uc = fs.readFileSync(userconfigSrc) | ||
var gcini = 'globalconfig = ' + exports.globalconfig + '\n' | ||
// atomic! | ||
fs.writeFileSync(exports.userconfig + '.' + process.pid, gcini + uc) | ||
fs.renameSync(exports.userconfig + '.' + process.pid, exports.userconfig) | ||
} | ||
|
||
exports.builtin = path.resolve(__dirname, 'fixtures', 'config', 'builtin') | ||
exports.malformed = path.resolve(__dirname, 'fixtures', 'config', 'malformed') | ||
exports.ucData = | ||
{ globalconfig: exports.globalconfig, | ||
email: 'i@izs.me', | ||
'env-thing': 'asdf', | ||
'init.author.name': 'Isaac Z. Schlueter', | ||
'init.author.email': 'i@izs.me', | ||
'init.author.url': 'http://blog.izs.me/', | ||
'init.version': '1.2.3', | ||
'npm:publishtest': true, | ||
'_npmjs.org:couch': 'https://admin:password@localhost:5984/registry', | ||
'npm-www:nocache': '1', | ||
nodedir: '/Users/isaacs/dev/js/node-v0.8', | ||
'sign-git-tag': true, | ||
message: 'v%s', | ||
'strict-ssl': false, | ||
'tmp': path.normalize(process.env.HOME + '/.tmp'), | ||
_auth: 'dXNlcm5hbWU6cGFzc3dvcmQ=', | ||
_token: | ||
{ AuthSession: 'yabba-dabba-doodle', | ||
version: '1', | ||
expires: '1345001053415', | ||
path: '/', | ||
httponly: true } } | ||
|
||
// set the userconfig in the env | ||
// unset anything else that npm might be trying to foist on us | ||
Object.keys(process.env).forEach(function (k) { | ||
if (k.match(/^npm_config_/i)) { | ||
delete process.env[k] | ||
} | ||
}) | ||
process.env.npm_config_userconfig = exports.userconfig | ||
process.env.npm_config_other_env_thing = '1000' | ||
process.env.random_env_var = 'asdf' | ||
process.env.npm_config__underbar_env_thing = 'underful' | ||
process.env.NPM_CONFIG_UPPERCASE_ENV_THING = '42' | ||
|
||
exports.envData = { | ||
userconfig: exports.userconfig, | ||
'_underbar-env-thing': 'underful', | ||
'uppercase-env-thing': '42', | ||
'other-env-thing': '1000' | ||
} | ||
exports.envDataFix = { | ||
userconfig: exports.userconfig, | ||
'_underbar-env-thing': 'underful', | ||
'uppercase-env-thing': 42, | ||
'other-env-thing': 1000 | ||
} | ||
|
||
var projectConf = path.resolve(__dirname, '..', '.npmrc') | ||
try { | ||
fs.statSync(projectConf) | ||
} catch (er) { | ||
// project conf not found, probably working with packed npm | ||
fs.writeFileSync(projectConf, '') | ||
} | ||
|
||
var projectRc = path.join(__dirname, 'fixtures', 'config', '.npmrc') | ||
try { | ||
fs.statSync(projectRc) | ||
} catch (er) { | ||
// project conf not found, probably working with packed npm | ||
fs.writeFileSync(projectRc, 'just = testing') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.