fix(core): handle empty positional overrides
This commit is contained in:
parent
4a5bda60c8
commit
694510e211
@ -10,7 +10,7 @@ describe('splitArgs', () => {
|
||||
base: 'sha1',
|
||||
head: 'sha2',
|
||||
notNxArg: true,
|
||||
_: ['--override'],
|
||||
override: true,
|
||||
$0: '',
|
||||
},
|
||||
'affected',
|
||||
@ -99,6 +99,7 @@ describe('splitArgs', () => {
|
||||
{
|
||||
files: [''],
|
||||
notNxArg: true,
|
||||
__positional_overrides__: [],
|
||||
$0: '',
|
||||
},
|
||||
'affected',
|
||||
@ -111,6 +112,26 @@ describe('splitArgs', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should split non nx specific arguments into target args (with positonal args)', () => {
|
||||
expect(
|
||||
splitArgsIntoNxArgsAndOverrides(
|
||||
{
|
||||
files: [''],
|
||||
notNxArg: true,
|
||||
__positional_overrides__: ['positional'],
|
||||
$0: '',
|
||||
},
|
||||
'affected',
|
||||
{} as any,
|
||||
{} as any
|
||||
).overrides
|
||||
).toEqual({
|
||||
_: ['positional'],
|
||||
__overrides_unparsed__: ['positional', '--notNxArg=true'],
|
||||
notNxArg: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should only use explicitly provided overrides', () => {
|
||||
expect(
|
||||
splitArgsIntoNxArgsAndOverrides(
|
||||
|
||||
@ -161,7 +161,10 @@ export function splitArgsIntoNxArgsAndOverrides(
|
||||
}
|
||||
}
|
||||
const overridesFromMainArgs = {} as any;
|
||||
if (args['__positional_overrides__']) {
|
||||
if (
|
||||
args['__positional_overrides__'] &&
|
||||
args['__positional_overrides__'].length > 0
|
||||
) {
|
||||
overridesFromMainArgs['_'] = args['__positional_overrides__'];
|
||||
}
|
||||
const nxArgs: RawNxArgs = {};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user