Skip to content

Commit

Permalink
Run tests on Windows (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored Aug 26, 2024
1 parent 9c3300c commit 8e6e317
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ on:
- pull_request
jobs:
test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
node-version:
- 22
- 18
os:
- ubuntu
- macos
- windows
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
12 changes: 6 additions & 6 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ test('"preferLocal: false", "addExecPath: false" does not add node_modules/.bin

test('the `cwd` option changes the current directory', t => {
t.is(
npmRunPath({path: '', cwd: '/dir'}).split(path.delimiter)[0],
path.normalize('/dir/node_modules/.bin'),
npmRunPath({path: '', cwd: './dir'}).split(path.delimiter)[0],
path.resolve('./dir/node_modules/.bin'),
);
});

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

Expand Down Expand Up @@ -88,7 +88,7 @@ test('the `execPath` option is relative to the `cwd` option', t => {
const pathEnv = npmRunPath({
path: '',
execPath: 'test/test',
cwd: '/dir',
cwd: './dir',
}).split(path.delimiter);
t.is(pathEnv.at(-2), path.normalize('/dir/test'));
t.is(pathEnv.at(-2), path.resolve('./dir/test'));
});

0 comments on commit 8e6e317

Please sign in to comment.