Welcome to mirror list, hosted at ThFree Co, Russian Federation.

is-windows-bash.js « utils « lib « test - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 94fde0ace17ce4ae7aa230dfd8f7d99c802ef0de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const t = require('tap')

const isWindowsBash = () => {
  delete require.cache[require.resolve('../../../lib/utils/is-windows-bash.js')]
  delete require.cache[require.resolve('../../../lib/utils/is-windows.js')]
  return require('../../../lib/utils/is-windows-bash.js')
}

Object.defineProperty(process, 'platform', {
  value: 'posix',
  configurable: true,
})
t.equal(isWindowsBash(), false, 'false when not windows')

Object.defineProperty(process, 'platform', {
  value: 'win32',
  configurable: true,
})
process.env.MSYSTEM = 'not ming'
process.env.TERM = 'dumb'
t.equal(isWindowsBash(), false, 'false when not mingw or cygwin')

process.env.TERM = 'cygwin'
t.equal(isWindowsBash(), true, 'true when cygwin')

process.env.MSYSTEM = 'MINGW64'
process.env.TERM = 'dumb'
t.equal(isWindowsBash(), true, 'true when mingw')