-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): fix not parse hex to number
- Loading branch information
Showing
2 changed files
with
93 additions
and
16 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
packages/nx/src/command-line/yargs-utils/shared-options.spec.ts
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import * as yargs from 'yargs'; | ||
|
||
import { withAffectedOptions, withRunManyOptions } from './shared-options'; | ||
|
||
const argv = yargs.default([]); | ||
|
||
describe('shared-options', () => { | ||
describe('withAffectedOptions', () => { | ||
const command = withAffectedOptions(argv); | ||
|
||
it('should parse files to array', () => { | ||
const result = command.parseSync([ | ||
'affected', | ||
'--files', | ||
'file1', | ||
'--files', | ||
'file2', | ||
'--tag', | ||
'81919e4', | ||
'--parallel', | ||
'3', | ||
'--maxParallel', | ||
'2', | ||
]); | ||
expect(result).toEqual( | ||
expect.objectContaining({ | ||
_: ['affected', '--tag', '81919e4'], | ||
files: ['file1', 'file2'], | ||
parallel: '3', | ||
maxParallel: 2, | ||
}) | ||
); | ||
}); | ||
|
||
it('should parse head and base', () => { | ||
const result = command.parseSync([ | ||
'affected', | ||
'--head', | ||
'head', | ||
'--base', | ||
'base', | ||
]); | ||
expect(result).toEqual( | ||
expect.objectContaining({ | ||
_: ['affected'], | ||
head: 'head', | ||
base: 'base', | ||
}) | ||
); | ||
}); | ||
}); | ||
|
||
describe('withRunManyOptions', () => { | ||
const command = withRunManyOptions(argv); | ||
|
||
it('should parse projects to array', () => { | ||
const result = command.parseSync([ | ||
'run-many', | ||
'--projects', | ||
'project1', | ||
'--projects', | ||
'project2', | ||
'--tag', | ||
'81919e4', | ||
'--parallel', | ||
'3', | ||
'--maxParallel', | ||
'2', | ||
]); | ||
expect(result).toEqual( | ||
expect.objectContaining({ | ||
_: ['run-many', '--tag', '81919e4'], | ||
projects: ['project1', 'project2'], | ||
parallel: '3', | ||
maxParallel: 2, | ||
}) | ||
); | ||
}); | ||
}); | ||
}); |
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