Skip to content

Commit ce0ede5

Browse files
committed
feat(test): adopt node:test
quotes
1 parent 7d883b5 commit ce0ede5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+198
-217
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
mkdir -p $NODE_GYP_TEMP_DIR
7878
npm pack
7979
tar xzf *.tgz -C $NODE_GYP_TEMP_DIR --strip-components=1
80-
cp -r test/ $NODE_GYP_TEMP_DIR/test/
80+
cp -r tests/ $NODE_GYP_TEMP_DIR/test/
8181
echo "dir=$NODE_GYP_TEMP_DIR" >> "$GITHUB_OUTPUT"
8282
- name: Test
8383
working-directory: ${{ steps.pack.outputs.dir }}

.npmignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/gyp/test
1010
/gyp/tools/
1111
/node-gyp-*.tgz
12-
/test/
13-
/test/.node-gyp
12+
/tests/
13+
/tests/.node-gyp
1414
/update-gyp.py
1515
node-gyp-*.tgz

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@
4040
"bindings": "^1.5.0",
4141
"cross-env": "^7.0.3",
4242
"eslint": "^9.16.0",
43-
"mocha": "^11.0.1",
4443
"nan": "^2.14.2",
4544
"neostandard": "^0.11.9",
4645
"require-inject": "^1.4.4"
4746
},
4847
"scripts": {
49-
"lint": "eslint \"*/*.js\" \"test/**/*.js\" \".github/**/*.js\"",
50-
"test": "cross-env NODE_GYP_NULL_LOGGER=true mocha --timeout 15000 test/test-download.js test/test-*"
48+
"lint": "eslint \"*/*.js\" \"tests/**/*.js\" \".github/**/*.js\"",
49+
"test": "cross-env NODE_GYP_NULL_LOGGER=true node --test"
5150
}
5251
}

test/common.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

test/simple-proxy.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

test/test-configure-python.js

Lines changed: 0 additions & 78 deletions
This file was deleted.

tests/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!node_modules
2+
node_modules/hello_world/build

tests/common.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const { cache } = require('env-paths')('node-gyp', { suffix: '' })
2+
const semver = require('semver')
3+
4+
module.exports = {
5+
devDir: cache,
6+
7+
poison (object, property) {
8+
const fail = () => {
9+
console.error(new Error(`Property ${property} should not have been accessed.`))
10+
process.abort()
11+
}
12+
Object.defineProperty(object, property, { configurable: false, enumerable: false, get: fail, set: fail })
13+
},
14+
15+
FULL_TEST: process.env.FULL_TEST === '1' && process.release.name === 'node' && !semver.prerelease(process.version),
16+
17+
platformTimeout (def, obj) {
18+
const platformTimeout = obj[process.platform]
19+
return platformTimeout ? platformTimeout * 60 * 1000 : def * 60 * 1000
20+
}
21+
}

0 commit comments

Comments
 (0)