Skip to content

Commit 130c129

Browse files
committed
chore: fix global test fixture for windows
1 parent 760dfad commit 130c129

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tap-snapshots/test/lib/commands/query.js.test.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ exports[`test/lib/commands/query.js TAP global > should return global package 1`
1313
1414
"pkgid": "[email protected]",
1515
"location": "node_modules/lorem",
16-
"path": "{CWD}/test/lib/commands/tap-testdir-query-global/global/lib/node_modules/lorem",
17-
"realpath": "{CWD}/test/lib/commands/tap-testdir-query-global/global/lib/node_modules/lorem",
16+
"path": "{CWD}/test/lib/commands/tap-testdir-query-global/global/node_modules/lorem",
17+
"realpath": "{CWD}/test/lib/commands/tap-testdir-query-global/global/node_modules/lorem",
1818
"resolved": null,
1919
"isLink": false,
2020
"isWorkspace": false

test/lib/commands/query.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ t.cleanSnapshot = (str) => {
77
.replace(/\r\n/g, '\n')
88
return normalizePath(str)
99
.replace(new RegExp(normalizePath(process.cwd()), 'g'), '{CWD}')
10+
// normalize between windows and posix
11+
.replace(new RegExp('lib/node_modules', 'g'), 'node_modules')
1012
}
1113

1214
t.test('simple query', async t => {
@@ -101,7 +103,17 @@ t.test('global', async t => {
101103
config: {
102104
global: true,
103105
},
106+
// This is a global dir that works in both windows and non-windows, that's
107+
// why it has two node_modules folders
104108
globalPrefixDir: {
109+
node_modules: {
110+
lorem: {
111+
'package.json': JSON.stringify({
112+
name: 'lorem',
113+
version: '2.0.0',
114+
}),
115+
},
116+
},
105117
lib: {
106118
node_modules: {
107119
lorem: {

0 commit comments

Comments
 (0)