-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathfault.test.js
More file actions
40 lines (36 loc) · 1.03 KB
/
Copy pathfault.test.js
File metadata and controls
40 lines (36 loc) · 1.03 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
import { platform } from 'node:process'
import test from 'ava'
import { each } from 'test-each'
import { runCliNoVersion } from './helpers/run.test.js'
import { INVALID_VERSION, TEST_VERSION } from './helpers/versions.test.js'
each(
[
{ versionRange: '', args: [] },
// This feature does not work on Windows cmd.exe
...(platform === 'win32'
? []
: [{ versionRange: TEST_VERSION, args: ['invalid'] }]),
],
({ title }, { versionRange, args }) => {
test(`Invalid input message | ${title}`, async (t) => {
const { stderr } = await runCliNoVersion(versionRange, args)
t.true(stderr.includes('Invalid input'))
})
},
)
each(
[
INVALID_VERSION,
`${TEST_VERSION},${INVALID_VERSION}`,
`--help ${INVALID_VERSION}`,
],
({ title }, versionRange) => {
test(`Invalid version range | ${title}`, async (t) => {
const { stderr } = await runCliNoVersion(versionRange, [
'node',
'--version',
])
t.true(stderr.includes('Not a valid Node version range'))
})
},
)