File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,6 @@ function isFileSpec (spec) {
6666 if ( isWindows ) {
6767 return isWindowsFile . test ( spec )
6868 }
69- // We never hit this in windows tests, obviously
70- /* istanbul ignore next */
7169 return isPosixFile . test ( spec )
7270}
7371
Original file line number Diff line number Diff line change 1+ // redefine process.platform before any requires so that we don't cache a require that got the non-redefined value
2+ const { platform } = process
3+ Object . defineProperty ( process , 'platform' , { value : 'linux' } )
4+
5+ const t = require ( 'tap' )
6+ const npa = require ( '..' )
7+
8+ t . teardown ( ( ) => {
9+ Object . defineProperty ( process , 'platform' , { value : platform } )
10+ } )
11+
12+ // These are purely for coverage
13+ // We need tests that act like linux so that code paths are covered both ways when testing in windows itself.
14+ //
15+ t . test ( 'file spec' , t => {
16+ const actual = npa ( './local' )
17+ t . equal ( actual . type , 'directory' )
18+ t . equal ( actual . raw , './local' )
19+ t . end ( )
20+ } )
21+
22+ t . test ( 'encoded path' , t => {
23+ const actual = npa ( './path\\backslash' )
24+ t . equal ( actual . rawSpec , './path/backslash' )
25+ t . end ( )
26+ } )
You can’t perform that action at this time.
0 commit comments