Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/npa.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ function isFileSpec (spec) {
if (isWindows) {
return isWindowsFile.test(spec)
}
// We never hit this in windows tests, obviously
/* istanbul ignore next */
return isPosixFile.test(spec)
}

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"node": "^20.17.0 || >=22.9.0"
},
"tap": {
"branches": 97,
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
Expand Down
26 changes: 26 additions & 0 deletions test/posix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// redefine process.platform before any requires so that we don't cache a require that got the non-redefined value
const { platform } = process
Object.defineProperty(process, 'platform', { value: 'linux' })

const t = require('tap')
const npa = require('..')

t.teardown(() => {
Object.defineProperty(process, 'platform', { value: platform })
})

// These are purely for coverage
// We need tests that act like linux so that code paths are covered both ways when testing in windows itself.
//
t.test('file spec', t => {
const actual = npa('./local')
t.equal(actual.type, 'directory')
t.equal(actual.raw, './local')
t.end()
})

t.test('encoded path', t => {
const actual = npa('./path\\backslash')
t.equal(actual.rawSpec, './path\\backslash')
t.end()
})
Loading