Skip to content

Commit

Permalink
chore: support tests on win32 (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbtools authored Nov 22, 2024
1 parent d606b58 commit 1ef54ba
Show file tree
Hide file tree
Showing 14 changed files with 497 additions and 347 deletions.
40 changes: 20 additions & 20 deletions tap-snapshots/test/dir.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`test/dir.js TAP basic > extract 1`] = `
Object {
"from": "file:test/fixtures/abbrev",
"integrity": "{integrity}",
"resolved": "\${CWD}/test/fixtures/abbrev",
"resolved": "{CWD}/test/fixtures/abbrev",
}
`

Expand All @@ -18,7 +18,7 @@ Object {
"_from": "file:test/fixtures/abbrev",
"_id": "[email protected]",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/abbrev",
"_resolved": "{CWD}/test/fixtures/abbrev",
"author": "Isaac Z. Schlueter <[email protected]>",
"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": "[email protected]",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/abbrev",
"_resolved": "{CWD}/test/fixtures/abbrev",
"author": "Isaac Z. Schlueter <[email protected]>",
"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": "[email protected]",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/abbrev",
"_resolved": "{CWD}/test/fixtures/abbrev",
"author": "Isaac Z. Schlueter <[email protected]>",
"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": "[email protected]",
"_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 <[email protected]>",
"description": "Like ruby's abbrev module, but in js",
"devDependencies": Object {
"tap": "^10.1",
},
"dist": Object {
"integrity": "{integrity}",
"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": "{integrity}",
"resolved": "\${CWD}/test/fixtures/bin-object",
"resolved": "{CWD}/test/fixtures/bin-object",
}
`

exports[`test/dir.js TAP responds to foregroundScripts: true > extract 1`] = `
Object {
"from": "file:test/fixtures/prepare-script",
"integrity": "{integrity}",
"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": "[email protected]",
"_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": "[email protected]",
"_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 All @@ -251,7 +251,7 @@ exports[`test/dir.js TAP with prepare script > extract 1`] = `
Object {
"from": "file:test/fixtures/prepare-script",
"integrity": "{integrity}",
"resolved": "\${CWD}/test/fixtures/prepare-script",
"resolved": "{CWD}/test/fixtures/prepare-script",
}
`

Expand All @@ -268,7 +268,7 @@ Object {
"_from": "file:test/fixtures/prepare-script",
"_id": "[email protected]",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/prepare-script",
"_resolved": "{CWD}/test/fixtures/prepare-script",
"devDependencies": Object {
"abbrev": "^1.1.1",
},
Expand All @@ -293,13 +293,13 @@ Object {
"_from": "file:test/fixtures/prepare-script",
"_id": "[email protected]",
"_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 All @@ -317,7 +317,7 @@ exports[`test/dir.js TAP with prepare script with scriptshell configuration > ex
Object {
"from": "file:test/fixtures/prepare-script",
"integrity": "{integrity}",
"resolved": "\${CWD}/test/fixtures/prepare-script",
"resolved": "{CWD}/test/fixtures/prepare-script",
}
`

Expand All @@ -334,7 +334,7 @@ Object {
"_from": "file:test/fixtures/prepare-script",
"_id": "[email protected]",
"_integrity": null,
"_resolved": "\${CWD}/test/fixtures/prepare-script",
"_resolved": "{CWD}/test/fixtures/prepare-script",
"devDependencies": Object {
"abbrev": "^1.1.1",
},
Expand All @@ -359,13 +359,13 @@ Object {
"_from": "file:test/fixtures/prepare-script",
"_id": "[email protected]",
"_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
22 changes: 11 additions & 11 deletions tap-snapshots/test/file.js.test.cjs
Original file line number Diff line number Diff line change
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": "[email protected]",
"_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 <[email protected]>",
"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": "[email protected]",
"_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 <[email protected]>",
"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,31 +109,31 @@ 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",
}
`

exports[`test/file.js TAP with readme > extract-slow-json 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 @@ -142,7 +142,7 @@ Object {
"_from": "file:test/fixtures/abbrev-1.1.1.tgz",
"_id": "[email protected]",
"_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": Object {
"email": "[email protected]",
"name": "Isaac Z. Schlueter",
Expand Down Expand Up @@ -237,7 +237,7 @@ Object {
"_from": "file:test/fixtures/abbrev-1.1.1.tgz",
"_id": "[email protected]",
"_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": Object {
"email": "[email protected]",
"name": "Isaac Z. Schlueter",
Expand All @@ -251,7 +251,7 @@ Object {
},
"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 Down
14 changes: 7 additions & 7 deletions tap-snapshots/test/index.js.test.cjs
Original file line number Diff line number Diff line change
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": "[email protected]",
"_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 <[email protected]>",
"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": "[email protected]",
"_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 <[email protected]>",
"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": "[email protected]",
"_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 <[email protected]>",
"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",
}
`
6 changes: 3 additions & 3 deletions test/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ const { Minipass } = require('minipass')
const pkg = require('../package.json')
const bin = require.resolve(`../${pkg.bin.pacote}`)
const { main, run, parseArg, parse } = require(bin)
const cleanSnapshot = require('./helpers/clean-snapshot.js')

t.cleanSnapshot = str =>
str.split(pkg.version).join('{VERSION}')
.split(process.env.HOME).join('{HOME}')
t.cleanSnapshot = str => cleanSnapshot(str)
.split(pkg.version).join('{VERSION}')

const pacote = require('../')
pacote.resolve = (spec, conf) =>
Expand Down
Loading

0 comments on commit 1ef54ba

Please sign in to comment.