Skip to content

Commit

Permalink
Hypernormalize snapshot paths and add npm for Windows CI benefit
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Feb 24, 2020
1 parent 9cc931e commit 18c13a6
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -26,7 +26,7 @@ jobs:

# Run for all environments
- name: Run Tap Tests
run: npm test
run: npm install npm; npm test

# Push coverage for specific environment
- name: Run Tap Tests (push coverage results)
Expand Down
18 changes: 9 additions & 9 deletions tap-snapshots/test-bin.js-TAP.test.js
Expand Up @@ -11,7 +11,7 @@ Object {
"exitlog": Array [],
"loglog": Array [
Array [
"Pacote - The JavaScript Package Handler, v{VERSION}\\n\\nUsage:\\n\\n pacote resolve <spec>\\n Resolve a specifier and output the fully resolved target\\n Returns integrity and from if '--long' flag is set.\\n\\n pacote manifest <spec>\\n Fetch a manifest and print to stdout\\n\\n pacote packument <spec>\\n Fetch a full packument and print to stdout\\n\\n pacote tarball <spec> [<filename>]\\n Fetch a package tarball and save to <filename>\\n If <filename> is missing or '-', the tarball will be streamed to stdout.\\n\\n pacote extract <spec> <folder>\\n Extract a package to the destination folder.\\n\\nConfiguration values all match the names of configs passed to npm, or\\noptions passed to Pacote. Additional flags for this executable:\\n\\n --long Print an object from 'resolve', including integrity and spec.\\n --json Print result objects as JSON rather than node's default.\\n (This is the default if stdout is not a TTY.)\\n --help -h Print this helpful text.\\n\\nFor example '--cache=/path/to/folder' will use that folder as the cache.\\n",
"Pacote - The JavaScript Package Handler, v{VERSION}/n/nUsage:/n/n pacote resolve <spec>/n Resolve a specifier and output the fully resolved target/n Returns integrity and from if '--long' flag is set./n/n pacote manifest <spec>/n Fetch a manifest and print to stdout/n/n pacote packument <spec>/n Fetch a full packument and print to stdout/n/n pacote tarball <spec> [<filename>]/n Fetch a package tarball and save to <filename>/n If <filename> is missing or '-', the tarball will be streamed to stdout./n/n pacote extract <spec> <folder>/n Extract a package to the destination folder./n/nConfiguration values all match the names of configs passed to npm, or/noptions passed to Pacote. Additional flags for this executable:/n/n --long Print an object from 'resolve', including integrity and spec./n --json Print result objects as JSON rather than node's default./n (This is the default if stdout is not a TTY.)/n --help -h Print this helpful text./n/nFor example '--cache=/path/to/folder' will use that folder as the cache./n",
],
],
}
Expand All @@ -24,7 +24,7 @@ Object {
"bad command: blerg",
],
Array [
"Pacote - The JavaScript Package Handler, v{VERSION}\\n\\nUsage:\\n\\n pacote resolve <spec>\\n Resolve a specifier and output the fully resolved target\\n Returns integrity and from if '--long' flag is set.\\n\\n pacote manifest <spec>\\n Fetch a manifest and print to stdout\\n\\n pacote packument <spec>\\n Fetch a full packument and print to stdout\\n\\n pacote tarball <spec> [<filename>]\\n Fetch a package tarball and save to <filename>\\n If <filename> is missing or '-', the tarball will be streamed to stdout.\\n\\n pacote extract <spec> <folder>\\n Extract a package to the destination folder.\\n\\nConfiguration values all match the names of configs passed to npm, or\\noptions passed to Pacote. Additional flags for this executable:\\n\\n --long Print an object from 'resolve', including integrity and spec.\\n --json Print result objects as JSON rather than node's default.\\n (This is the default if stdout is not a TTY.)\\n --help -h Print this helpful text.\\n\\nFor example '--cache=/path/to/folder' will use that folder as the cache.\\n",
"Pacote - The JavaScript Package Handler, v{VERSION}/n/nUsage:/n/n pacote resolve <spec>/n Resolve a specifier and output the fully resolved target/n Returns integrity and from if '--long' flag is set./n/n pacote manifest <spec>/n Fetch a manifest and print to stdout/n/n pacote packument <spec>/n Fetch a full packument and print to stdout/n/n pacote tarball <spec> [<filename>]/n Fetch a package tarball and save to <filename>/n If <filename> is missing or '-', the tarball will be streamed to stdout./n/n pacote extract <spec> <folder>/n Extract a package to the destination folder./n/nConfiguration values all match the names of configs passed to npm, or/noptions passed to Pacote. Additional flags for this executable:/n/n --long Print an object from 'resolve', including integrity and spec./n --json Print result objects as JSON rather than node's default./n (This is the default if stdout is not a TTY.)/n --help -h Print this helpful text./n/nFor example '--cache=/path/to/folder' will use that folder as the cache./n",
],
],
"exitlog": Array [],
Expand All @@ -38,7 +38,7 @@ Object {
"exitlog": Array [],
"loglog": Array [
Array [
"{\\n \\"method\\": \\"extract\\",\\n \\"spec\\": \\"npm@latest-6\\",\\n \\"dest\\": \\"folder\\",\\n \\"conf\\": {\\n \\"_\\": [\\n \\"extract\\",\\n \\"npm@latest-6\\",\\n \\"folder\\"\\n ],\\n \\"cache\\": \\"{HOME}/.npm/_cacache\\",\\n \\"json\\": true\\n }\\n}",
"{/n /"method/": /"extract/",/n /"spec/": /"npm@latest-6/",/n /"dest/": /"folder/",/n /"conf/": {/n /"_/": [/n /"extract/",/n /"npm@latest-6/",/n /"folder/"/n ],/n /"cache/": /"{HOME}/.npm/_cacache/",/n /"json/": true/n }/n}",
],
],
}
Expand Down Expand Up @@ -75,7 +75,7 @@ Object {
"exitlog": Array [],
"loglog": Array [
Array [
"{\\n \\"method\\": \\"manifest\\",\\n \\"spec\\": \\"bar@foo\\",\\n \\"conf\\": {\\n \\"_\\": [\\n \\"manifest\\",\\n \\"bar@foo\\"\\n ],\\n \\"cache\\": \\"{HOME}/.npm/_cacache\\"\\n },\\n \\"_resolved\\": \\"manifest resolved\\",\\n \\"_integrity\\": \\"manifest integrity\\",\\n \\"_from\\": \\"manifest from\\"\\n}",
"{/n /"method/": /"manifest/",/n /"spec/": /"bar@foo/",/n /"conf/": {/n /"_/": [/n /"manifest/",/n /"bar@foo/"/n ],/n /"cache/": /"{HOME}/.npm/_cacache/"/n },/n /"_resolved/": /"manifest resolved/",/n /"_integrity/": /"manifest integrity/",/n /"_from/": /"manifest from/"/n}",
],
],
}
Expand All @@ -87,7 +87,7 @@ Object {
"exitlog": Array [],
"loglog": Array [
Array [
"{\\n \\"method\\": \\"packument\\",\\n \\"spec\\": \\"paku@mint\\",\\n \\"conf\\": {\\n \\"_\\": [\\n \\"packument\\",\\n \\"paku@mint\\"\\n ],\\n \\"cache\\": \\"{HOME}/.npm/_cacache\\"\\n }\\n}",
"{/n /"method/": /"packument/",/n /"spec/": /"paku@mint/",/n /"conf/": {/n /"_/": [/n /"packument/",/n /"paku@mint/"/n ],/n /"cache/": /"{HOME}/.npm/_cacache/"/n }/n}",
],
],
}
Expand All @@ -113,7 +113,7 @@ Object {
"exitlog": Array [],
"loglog": Array [
Array [
"{\\n \\"resolved\\": \\"manifest resolved\\",\\n \\"integrity\\": \\"manifest integrity\\",\\n \\"from\\": \\"manifest from\\"\\n}",
"{/n /"resolved/": /"manifest resolved/",/n /"integrity/": /"manifest integrity/",/n /"from/": /"manifest from/"/n}",
],
],
}
Expand All @@ -125,7 +125,7 @@ Object {
"exitlog": Array [],
"loglog": Array [
Array [
"{\\n \\"method\\": \\"resolve\\",\\n \\"spec\\": \\"foo@bar\\",\\n \\"conf\\": {\\n \\"_\\": [\\n \\"resolve\\",\\n \\"foo@bar\\"\\n ],\\n \\"cache\\": \\"{HOME}/.npm/_cacache\\"\\n }\\n}",
"{/n /"method/": /"resolve/",/n /"spec/": /"foo@bar/",/n /"conf/": {/n /"_/": [/n /"resolve/",/n /"foo@bar/"/n ],/n /"cache/": /"{HOME}/.npm/_cacache/"/n }/n}",
],
],
}
Expand All @@ -137,7 +137,7 @@ Object {
"exitlog": Array [],
"loglog": Array [
Array [
"\\"just a string\\"",
"/"just a string/"",
],
],
}
Expand All @@ -161,7 +161,7 @@ Object {
"exitlog": Array [],
"loglog": Array [
Array [
"{\\n \\"method\\": \\"tarball\\",\\n \\"spec\\": \\"tar@ball\\",\\n \\"file\\": \\"file.tgz\\",\\n \\"conf\\": {\\n \\"_\\": [\\n \\"tarball\\",\\n \\"tar@ball\\",\\n \\"file.tgz\\"\\n ],\\n \\"cache\\": \\"{HOME}/.npm/_cacache\\"\\n }\\n}",
"{/n /"method/": /"tarball/",/n /"spec/": /"tar@ball/",/n /"file/": /"file.tgz/",/n /"conf/": {/n /"_/": [/n /"tarball/",/n /"tar@ball/",/n /"file.tgz/"/n ],/n /"cache/": /"{HOME}/.npm/_cacache/"/n }/n}",
],
],
}
Expand Down
24 changes: 12 additions & 12 deletions tap-snapshots/test-dir.js-TAP.test.js
Expand Up @@ -9,7 +9,7 @@ exports[`test/dir.js TAP basic > extract 1`] = `
Object {
"from": "file:test/fixtures/abbrev",
"integrity": "sha512-Ict4yhLfiPOkcX+yjBRSI2QUetKt+A08AXMyLeQbKGYg/OGI/1k47Hu9tWZOx1l4j+M1z07Zxt3IL41TmLkbDw==",
"resolved": "\${CWD}/test/fixtures/abbrev",
"resolved": "{CWD}/test/fixtures/abbrev",
}
`

Expand All @@ -18,7 +18,7 @@ Object {
"_from": "file:test/fixtures/abbrev",
"_id": "abbrev@1.1.1",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/abbrev",
"_resolved": "{CWD}/test/fixtures/abbrev",
"author": "Isaac Z. Schlueter <i@izs.me>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
Expand Down Expand Up @@ -76,15 +76,15 @@ Object {
"_from": "file:test/fixtures/abbrev",
"_id": "abbrev@1.1.1",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/abbrev",
"_resolved": "{CWD}/test/fixtures/abbrev",
"author": "Isaac Z. Schlueter <i@izs.me>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
"tap": "^10.1",
},
"dist": Object {
"integrity": null,
"tarball": "file:\${CWD}/test/fixtures/abbrev",
"tarball": "file:{CWD}/test/fixtures/abbrev",
},
"files": Array [
"abbrev.js",
Expand All @@ -110,7 +110,7 @@ Object {
"_from": "file:test/fixtures/abbrev",
"_id": "abbrev@1.1.1",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/abbrev",
"_resolved": "{CWD}/test/fixtures/abbrev",
"author": "Isaac Z. Schlueter <i@izs.me>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
Expand Down Expand Up @@ -144,15 +144,15 @@ Object {
"_from": "file:test/fixtures/abbrev",
"_id": "abbrev@1.1.1",
"_integrity": "sha512-whatever-this-is-only-checked-if-we-extract-it",
"_resolved": "\${CWD}/test/fixtures/abbrev",
"_resolved": "{CWD}/test/fixtures/abbrev",
"author": "Isaac Z. Schlueter <i@izs.me>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
"tap": "^10.1",
},
"dist": Object {
"integrity": "sha512-whatever-this-is-only-checked-if-we-extract-it",
"tarball": "file:\${CWD}/test/fixtures/abbrev",
"tarball": "file:{CWD}/test/fixtures/abbrev",
},
"files": Array [
"abbrev.js",
Expand All @@ -177,15 +177,15 @@ exports[`test/dir.js TAP make bins executable > results of unpack 1`] = `
Object {
"from": "file:test/fixtures/bin-object",
"integrity": "sha512-rlE32nBV7XgKCm0I7YqAewyVPbaRJWUQMZUFLlngGK3imG+som3Hin7d/zPTikWg64tHIxb8VXeeq6u0IRRfmQ==",
"resolved": "\${CWD}/test/fixtures/bin-object",
"resolved": "{CWD}/test/fixtures/bin-object",
}
`

exports[`test/dir.js TAP with prepare script > extract 1`] = `
Object {
"from": "file:test/fixtures/prepare-script",
"integrity": "sha512-HTzPAt8wmXNchUdisnGDSCuUgrFee5v8F6GsLc5mQd29VXiNzv4PGz71jjLSIF1wWQSB+UjLTmSJSGznF/s/Lw==",
"resolved": "\${CWD}/test/fixtures/prepare-script",
"resolved": "{CWD}/test/fixtures/prepare-script",
}
`

Expand All @@ -202,7 +202,7 @@ Object {
"_from": "file:test/fixtures/prepare-script",
"_id": "git-prepare-script@1.0.0",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/prepare-script",
"_resolved": "{CWD}/test/fixtures/prepare-script",
"devDependencies": Object {
"abbrev": "^1.1.1",
},
Expand All @@ -227,13 +227,13 @@ Object {
"_from": "file:test/fixtures/prepare-script",
"_id": "git-prepare-script@1.0.0",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/prepare-script",
"_resolved": "{CWD}/test/fixtures/prepare-script",
"devDependencies": Object {
"abbrev": "^1.1.1",
},
"dist": Object {
"integrity": null,
"tarball": "file:\${CWD}/test/fixtures/prepare-script",
"tarball": "file:{CWD}/test/fixtures/prepare-script",
},
"license": "ISC",
"main": "index.js",
Expand Down
14 changes: 7 additions & 7 deletions tap-snapshots/test-file.js-TAP.test.js
Expand Up @@ -9,7 +9,7 @@ exports[`test/file.js TAP basic > extract 1`] = `
Object {
"from": "file:test/fixtures/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"resolved": "\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"resolved": "{CWD}/test/fixtures/abbrev-1.1.1.tgz",
}
`

Expand All @@ -18,7 +18,7 @@ Object {
"_from": "file:test/fixtures/abbrev-1.1.1.tgz",
"_id": "abbrev@1.1.1",
"_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"_resolved": "\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"_resolved": "{CWD}/test/fixtures/abbrev-1.1.1.tgz",
"author": "Isaac Z. Schlueter <i@izs.me>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
Expand Down Expand Up @@ -76,15 +76,15 @@ Object {
"_from": "file:test/fixtures/abbrev-1.1.1.tgz",
"_id": "abbrev@1.1.1",
"_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"_resolved": "\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"_resolved": "{CWD}/test/fixtures/abbrev-1.1.1.tgz",
"author": "Isaac Z. Schlueter <i@izs.me>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
"tap": "^10.1",
},
"dist": Object {
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"tarball": "file:\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"tarball": "file:{CWD}/test/fixtures/abbrev-1.1.1.tgz",
},
"files": Array [
"abbrev.js",
Expand All @@ -109,22 +109,22 @@ exports[`test/file.js TAP make bins executable bin-good > results of unpack 1`]
Object {
"from": "file:test/fixtures/bin-good.tgz",
"integrity": "sha512-Fx11OiHxV82CztnPk+k0S6H/66J4/eUzZEMGX2dJjP+Mxfrm8fSzE4SQG604zWk17ELZsOGENCdWSkvj4cpjUw==",
"resolved": "\${CWD}/test/fixtures/bin-good.tgz",
"resolved": "{CWD}/test/fixtures/bin-good.tgz",
}
`

exports[`test/file.js TAP make bins executable bin-object > results of unpack 1`] = `
Object {
"from": "file:test/fixtures/bin-object.tgz",
"integrity": "sha512-TqzCjecWyQe8vqLbT0nv/OaWf0ptRZ2DnPmiuGUYJJb70shp02+/uu37IJSkM2ZEP1SAOeKrYrWPVIIYW+d//g==",
"resolved": "\${CWD}/test/fixtures/bin-object.tgz",
"resolved": "{CWD}/test/fixtures/bin-object.tgz",
}
`

exports[`test/file.js TAP make bins executable bin-string > results of unpack 1`] = `
Object {
"from": "file:test/fixtures/bin-string.tgz",
"integrity": "sha512-iCc87DMYVMofO221ksAlMD88Zgsr4OIvqeX73KxTPikWaQPvBFZpzI9FGWnD4PTLTyJzOSETQh86+IwEidJRZg==",
"resolved": "\${CWD}/test/fixtures/bin-string.tgz",
"resolved": "{CWD}/test/fixtures/bin-string.tgz",
}
`
14 changes: 7 additions & 7 deletions tap-snapshots/test-index.js-TAP.test.js
Expand Up @@ -9,7 +9,7 @@ exports[`test/index.js TAP > extract 1`] = `
Object {
"from": "file:test/fixtures/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"resolved": "\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"resolved": "{CWD}/test/fixtures/abbrev-1.1.1.tgz",
}
`

Expand All @@ -18,7 +18,7 @@ Object {
"_from": "file:test/fixtures/abbrev-1.1.1.tgz",
"_id": "abbrev@1.1.1",
"_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"_resolved": "\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"_resolved": "{CWD}/test/fixtures/abbrev-1.1.1.tgz",
"author": "Isaac Z. Schlueter <i@izs.me>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
Expand Down Expand Up @@ -46,7 +46,7 @@ Object {
"_from": "file:test/fixtures/abbrev-1.1.1.tgz",
"_id": "abbrev@1.1.1",
"_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"_resolved": "\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"_resolved": "{CWD}/test/fixtures/abbrev-1.1.1.tgz",
"author": "Isaac Z. Schlueter <i@izs.me>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
Expand Down Expand Up @@ -80,15 +80,15 @@ Object {
"_from": "file:test/fixtures/abbrev-1.1.1.tgz",
"_id": "abbrev@1.1.1",
"_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"_resolved": "\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"_resolved": "{CWD}/test/fixtures/abbrev-1.1.1.tgz",
"author": "Isaac Z. Schlueter <i@izs.me>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
"tap": "^10.1",
},
"dist": Object {
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"tarball": "file:\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"tarball": "file:{CWD}/test/fixtures/abbrev-1.1.1.tgz",
},
"files": Array [
"abbrev.js",
Expand All @@ -110,13 +110,13 @@ Object {
`

exports[`test/index.js TAP > resolve 1`] = `
\${CWD}/test/fixtures/abbrev-1.1.1.tgz
{CWD}/test/fixtures/abbrev-1.1.1.tgz
`

exports[`test/index.js TAP > tarball to file 1`] = `
Object {
"from": "file:test/fixtures/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"resolved": "\${CWD}/test/fixtures/abbrev-1.1.1.tgz",
"resolved": "{CWD}/test/fixtures/abbrev-1.1.1.tgz",
}
`
13 changes: 10 additions & 3 deletions test/bin.js
Expand Up @@ -3,9 +3,16 @@ const {main, run, usage, parseArg, parse} = require('../lib/bin.js')
const {spawn} = require('child_process')
const t = require('tap')
const version = require('../package.json').version
t.cleanSnapshot = str =>
str.split(version).join('{VERSION}')
.split(process.env.HOME).join('{HOME}')
t.cleanSnapshot = str => str
.split(version).join('{VERSION}')
.replace(/\\+/g, '/')
.replace(re(process.env.HOME), '{HOME}')

// on GitHub Actions windows, the HOME dir is potentially randomly cased.
const re = str => {
const pattern = str.replace(/\\+/g, '/').replace(/:/g, '\\:')
return new RegExp(pattern, 'ig')
}

const pacote = require('../')
const called = []
Expand Down
9 changes: 8 additions & 1 deletion test/dir.js
Expand Up @@ -8,7 +8,14 @@ const { relative, resolve, basename } = require('path')

const me = t.testdir()

t.cleanSnapshot = str => str.split(process.cwd()).join('${CWD}')
t.cleanSnapshot = str => str.replace(/\\+/g, '/')
.replace(re(process.cwd()), '{CWD}')

// on GitHub Actions windows, the dirs are potentially randomly cased.
const re = str => {
const pattern = str.replace(/\\+/g, '/').replace(/:/g, '\\:')
return new RegExp(pattern, 'ig')
}

const abbrev = resolve(__dirname, 'fixtures/abbrev')
const abbrevspec = `file:${relative(process.cwd(), abbrev)}`
Expand Down
9 changes: 8 additions & 1 deletion test/fetcher.js
Expand Up @@ -18,7 +18,14 @@ const { relative, resolve, basename } = require('path')
const t = require('tap')
const me = t.testdir()
const Fetcher = require('../lib/fetcher.js')
t.cleanSnapshot = s => s.split(process.cwd()).join('{CWD}')
t.cleanSnapshot = str => str.replace(/\\+/g, '/')
.replace(re(process.cwd()), '{CWD}')

// on GitHub Actions windows, the dirs are potentially randomly cased.
const re = str => {
const pattern = str.replace(/\\+/g, '/').replace(/:/g, '\\:')
return new RegExp(pattern, 'ig')
}

const npa = require('npm-package-arg')
const { promisify } = require('util')
Expand Down

0 comments on commit 18c13a6

Please sign in to comment.