-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8dcc02
commit f76d4f2
Showing
16 changed files
with
63 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
module.exports = process.platform === 'win32' | ||
const isWindows = process.platform === 'win32' | ||
const isWindowsShell = isWindows && | ||
!/^MINGW(32|64)$/.test(process.env.MSYSTEM) && process.env.TERM !== 'cygwin' | ||
|
||
exports.isWindows = isWindows | ||
exports.isWindowsShell = isWindowsShell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
// return the PATH array in a cross-platform way | ||
// TODO this is only used in a single place | ||
const PATH = process.env.PATH || process.env.Path || process.env.path | ||
const { delimiter } = require('path') | ||
module.exports = PATH.split(delimiter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
const t = require('tap') | ||
const actuallyWindows = process.platform === 'win32' | ||
t.equal(actuallyWindows, require('../../../lib/utils/is-windows.js')) | ||
Object.defineProperty(process, 'platform', { | ||
value: actuallyWindows ? 'posix' : 'win32', | ||
|
||
const mockGlobals = require('../../fixtures/mock-globals') | ||
|
||
t.test('is not windows', async t => { | ||
mockGlobals(t, { 'process.platform': 'posix' }) | ||
t.match({ | ||
isWindows: false, | ||
isWindowsShell: false, | ||
}, t.mock('../../../lib/utils/is-windows.js')) | ||
}) | ||
|
||
t.test('is windows, shell', async t => { | ||
mockGlobals(t, { | ||
'process.platform': 'win32', | ||
'process.env': { | ||
MSYSTEM: 'notmingw', | ||
TERM: 'notcygwin', | ||
}, | ||
}) | ||
t.match({ | ||
isWindows: true, | ||
isWindowsShell: true, | ||
}, t.mock('../../../lib/utils/is-windows.js')) | ||
}) | ||
|
||
t.test('is windows, not shell', async t => { | ||
mockGlobals(t, { | ||
'process.platform': 'win32', | ||
'process.env': { | ||
MSYSTEM: 'MINGW32', | ||
TERM: 'cygwin', | ||
}, | ||
}) | ||
t.match({ | ||
isWindows: true, | ||
isWindowsShell: false, | ||
}, t.mock('../../../lib/utils/is-windows.js')) | ||
}) | ||
delete require.cache[require.resolve('../../../lib/utils/is-windows.js')] | ||
t.equal(!actuallyWindows, require('../../../lib/utils/is-windows.js')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters