Skip to content

Commit 88cfb88

Browse files
ruyadornoMichael Perrotte
authored andcommitted
chore: fixes nodejs tests
- Fixes ability to run tests using an arbitrary node bin - Fixes `make test-npm` in nodejs repo - Added `tap-snapshots` folder - Added required `.npmrc` root file Fixes npm/statusboard#45 PR-URL: #696 Credit: @ruyadorno Close: #696 Reviewed-by: @mikemimik
1 parent ac3739f commit 88cfb88

File tree

9 files changed

+24
-9
lines changed

9 files changed

+24
-9
lines changed

lib/utils/unsupported.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ var supportedNode = [
77
{ver: '10', min: '10.0.0'},
88
{ver: '11', min: '11.0.0'},
99
{ver: '12', min: '12.0.0'},
10-
{ver: '13', min: '13.0.0'}
10+
{ver: '13', min: '13.0.0'},
11+
{ver: '14', min: '14.0.0'}
1112
]
1213
var knownBroken = '<6.2.0 || 9.0 - 9.2'
1314

scripts/release.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ node ./bin/npm-cli.js pack --loglevel error >/dev/null
1212
mv *.tgz release
1313
cd release
1414
tar xzf *.tgz
15+
cp ../.npmrc package/
16+
cp -r ../tap-snapshots package/
1517
cp -r ../test package/
1618

1719
mkdir node_modules

test/tap/ci.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ const File = Tacks.File
1515
const cacheDir = common.cache
1616
const testDir = common.pkg
1717

18-
const EXEC_OPTS = { cwd: testDir }
18+
const EXEC_OPTS = {
19+
cwd: testDir,
20+
nodeExecPath: process.execPath
21+
}
1922

2023
const PKG = {
2124
name: 'top',

test/tap/prepare.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ test('test', function (t) {
5555
common.npm([
5656
'pack',
5757
'--loglevel', 'warn'
58-
], { cwd: pkg, env: env }, function (err, code, stdout, stderr) {
58+
], {
59+
cwd: pkg,
60+
env: env,
61+
nodeExecPath: process.execPath
62+
}, function (err, code, stdout, stderr) {
5963
t.equal(code, 0, 'pack finished successfully')
6064
t.ifErr(err, 'pack finished successfully')
6165

test/tap/prepublish-only.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ test('test', function (t) {
9898
common.npm(
9999
[
100100
'publish',
101-
'--loglevel', 'warn'
101+
'--loglevel', 'warn',
102+
'--scripts-prepend-node-path'
102103
],
103104
{
104105
cwd: pkg,

test/tap/publish-scoped.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ test('npm publish should honor scoping', function (t) {
4646

4747
fs.writeFileSync(configFile, configuration.join('\n') + '\n')
4848

49-
common.npm(['publish'], {'cwd': pkg}, function (err, code, stdout, stderr) {
49+
common.npm(['publish'], {'cwd': pkg, nodeExecPath: process.execPath}, function (err, code, stdout, stderr) {
5050
if (err) throw err
5151
t.is(code, 0, 'published without error')
5252
server.done()

test/tap/publish.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ test('basic npm publish', (t) => {
5252
`--//localhost:${server.port}/:username=username`,
5353
`--//localhost:${server.port}/:_password=` + Buffer.from('password').toString('base64'),
5454
`--//localhost:${server.port}/:email=` + '[email protected]'
55-
], {'cwd': testDir})
55+
], {
56+
'cwd': testDir,
57+
nodeExecPath: process.execPath
58+
})
5659
.spread((code, stdout, stderr) => {
5760
t.comment(stdout)
5861
t.comment(stderr)

test/tap/umask-lifecycle.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ test('setup', function (t) {
4040
})
4141

4242
test('umask script', function (t) {
43-
common.npm(['run', 'umask'], {
43+
common.npm(['run', 'umask', '--scripts-prepend-node-path'], {
4444
cwd: pkg,
4545
env: {
4646
PATH: process.env.PATH,
4747
Path: process.env.Path,
48-
'npm_config_loglevel': 'warn'
48+
'npm_config_loglevel': 'warn',
49+
nodeExecPath: process.execPath
4950
}
5051
}, function (er, code, sout, serr) {
5152
t.equal(sout, expected)

test/tap/version-no-package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test('npm version in a prefix with no package.json', function (t) {
77
process.chdir(pkg)
88
common.npm(
99
['version', '--json', '--prefix', pkg],
10-
{ cwd: pkg },
10+
{ cwd: pkg, nodeExecPath: process.execPath },
1111
function (er, code, stdout, stderr) {
1212
t.ifError(er, "npm version doesn't care that there's no package.json")
1313
t.notOk(code, 'npm version ran without barfing')

0 commit comments

Comments
 (0)