Skip to content

Commit 018641b

Browse files
committed
Run tests on Windows
1 parent 9c3300c commit 018641b

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ on:
44
- pull_request
55
jobs:
66
test:
7-
name: Node.js ${{ matrix.node-version }}
8-
runs-on: ubuntu-latest
7+
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}-latest
99
strategy:
1010
fail-fast: false
1111
matrix:
1212
node-version:
1313
- 22
1414
- 18
15+
os:
16+
- ubuntu
17+
- macos
18+
- windows
1519
steps:
1620
- uses: actions/checkout@v4
1721
- uses: actions/setup-node@v4

test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ test('"preferLocal: false", "addExecPath: false" does not add node_modules/.bin
3232

3333
test('the `cwd` option changes the current directory', t => {
3434
t.is(
35-
npmRunPath({path: '', cwd: '/dir'}).split(path.delimiter)[0],
36-
path.normalize('/dir/node_modules/.bin'),
35+
npmRunPath({path: '', cwd: './dir'}).split(path.delimiter)[0],
36+
path.resolve('./dir/node_modules/.bin'),
3737
);
3838
});
3939

4040
test('the `cwd` option can be a file URL', t => {
4141
t.is(
42-
npmRunPath({path: '', cwd: new URL('file:///dir')}).split(path.delimiter)[0],
43-
path.normalize('/dir/node_modules/.bin'),
42+
npmRunPath({path: '', cwd: new URL('dir', import.meta.url)}).split(path.delimiter)[0],
43+
fileURLToPath(new URL('dir/node_modules/.bin', import.meta.url)),
4444
);
4545
});
4646

@@ -88,7 +88,7 @@ test('the `execPath` option is relative to the `cwd` option', t => {
8888
const pathEnv = npmRunPath({
8989
path: '',
9090
execPath: 'test/test',
91-
cwd: '/dir',
91+
cwd: './dir',
9292
}).split(path.delimiter);
93-
t.is(pathEnv.at(-2), path.normalize('/dir/test'));
93+
t.is(pathEnv.at(-2), path.resolve('./dir/test'));
9494
});

0 commit comments

Comments
 (0)