Skip to content

Commit

Permalink
chore: fix global test fixture for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Jun 22, 2022
1 parent 760dfad commit 130c129
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tap-snapshots/test/lib/commands/query.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ exports[`test/lib/commands/query.js TAP global > should return global package 1`
"_id": "lorem@2.0.0",
"pkgid": "lorem@2.0.0",
"location": "node_modules/lorem",
"path": "{CWD}/test/lib/commands/tap-testdir-query-global/global/lib/node_modules/lorem",
"realpath": "{CWD}/test/lib/commands/tap-testdir-query-global/global/lib/node_modules/lorem",
"path": "{CWD}/test/lib/commands/tap-testdir-query-global/global/node_modules/lorem",
"realpath": "{CWD}/test/lib/commands/tap-testdir-query-global/global/node_modules/lorem",
"resolved": null,
"isLink": false,
"isWorkspace": false
Expand Down
12 changes: 12 additions & 0 deletions test/lib/commands/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ t.cleanSnapshot = (str) => {
.replace(/\r\n/g, '\n')
return normalizePath(str)
.replace(new RegExp(normalizePath(process.cwd()), 'g'), '{CWD}')
// normalize between windows and posix
.replace(new RegExp('lib/node_modules', 'g'), 'node_modules')
}

t.test('simple query', async t => {
Expand Down Expand Up @@ -101,7 +103,17 @@ t.test('global', async t => {
config: {
global: true,
},
// This is a global dir that works in both windows and non-windows, that's
// why it has two node_modules folders
globalPrefixDir: {
node_modules: {
lorem: {
'package.json': JSON.stringify({
name: 'lorem',
version: '2.0.0',
}),
},
},
lib: {
node_modules: {
lorem: {
Expand Down

0 comments on commit 130c129

Please sign in to comment.