-
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): not parse hex to number (#27515)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #26889 (cherry picked from commit ec53f31)
- Loading branch information
1 parent
b32a571
commit be620eb
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