Skip to content

Commit 9e018cf

Browse files
committed
tests: run (and pass) on windows
Threw a kludge in there to run tap with lower coverage reqs on Windows.
1 parent c2a0948 commit 9e018cf

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

.github/workflows/ci.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,8 @@ jobs:
1212
shell: bash
1313
- os: macos-latest
1414
shell: bash
15-
16-
# TODO: make tests pass on windows. it works, but the tests have
17-
# quite a lot of unixisms wrt modes and paths. mostly trivial
18-
# stuff to fix, but a lot of it.
19-
#
20-
# - os: windows-latest
21-
# shell: bash
22-
# - os: windows-latest
23-
# shell: powershell
15+
- os: windows-latest
16+
shell: powershell
2417

2518
fail-fast: false
2619

@@ -42,6 +35,9 @@ jobs:
4235
with:
4336
node-version: ${{ matrix.node-version }}
4437

38+
- name: use latest npm
39+
run: npm i -g npm@latest
40+
4541
- name: Install dependencies
4642
run: npm install
4743

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"url": "https://github.com/npm/node-tar.git"
99
},
1010
"scripts": {
11-
"test": "tap",
11+
"test:posix": "tap",
12+
"test:win32": "tap --lines=98 --branches=98 --statements=98 --functions=98",
13+
"test": "node test/fixtures/test.js",
1214
"posttest": "npm run lint",
1315
"eslint": "eslint",
1416
"lint": "npm run eslint -- test lib",

test/fixtures/test.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const platform = process.platform === 'win32' ? 'win32' : 'posix'
2+
const {spawn} = require('child_process')
3+
const c = spawn(process.execPath, [
4+
process.env.npm_execpath,
5+
'run',
6+
`test:${platform}`,
7+
'--',
8+
...process.argv.slice(2),
9+
], {
10+
stdio: 'inherit',
11+
})
12+
c.on('close', (code, signal) => {
13+
process.exitCode = code
14+
if (signal) {
15+
process.kill(process.pid, signal)
16+
setTimeout(() => {}, 200)
17+
}
18+
})
19+
process.on('SIGTERM', () => c.kill('SIGTERM'))
20+
process.on('SIGINT', () => c.kill('SIGINT'))

0 commit comments

Comments
 (0)