fix(core): handle undefined properties in schemas with additionalProperties (#22426)
This commit is contained in:
parent
81cf348f55
commit
bb4dd7d18f
@ -190,6 +190,27 @@ describe('Nx Running Tests', () => {
|
|||||||
expect(output).toContain(app);
|
expect(output).toContain(app);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should pass env option to nx:run-commands executor', () => {
|
||||||
|
const mylib = uniq('mylib');
|
||||||
|
runCLI(`generate @nx/js:lib ${mylib}`);
|
||||||
|
|
||||||
|
updateJson(`libs/${mylib}/project.json`, (c) => {
|
||||||
|
c.targets['echo'] = {
|
||||||
|
executor: 'nx:run-commands',
|
||||||
|
options: {
|
||||||
|
command: 'node -e "console.log(process.env.ONE)"',
|
||||||
|
env: {
|
||||||
|
ONE: 'TWO',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return c;
|
||||||
|
});
|
||||||
|
|
||||||
|
const output = runCLI(`echo ${mylib}`);
|
||||||
|
expect(output).toContain('TWO');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Nx Bail', () => {
|
describe('Nx Bail', () => {
|
||||||
|
|||||||
@ -351,7 +351,7 @@ export class TaskOrchestrator {
|
|||||||
const temporaryOutputPath = this.cache.temporaryOutputPath(task);
|
const temporaryOutputPath = this.cache.temporaryOutputPath(task);
|
||||||
const streamOutput = shouldStreamOutput(task, this.initiatingProject);
|
const streamOutput = shouldStreamOutput(task, this.initiatingProject);
|
||||||
|
|
||||||
const env = pipeOutput
|
let env = pipeOutput
|
||||||
? getEnvVariablesForTask(
|
? getEnvVariablesForTask(
|
||||||
task,
|
task,
|
||||||
taskSpecificEnv,
|
taskSpecificEnv,
|
||||||
@ -403,6 +403,12 @@ export class TaskOrchestrator {
|
|||||||
relative(task.projectRoot ?? workspaceRoot, process.cwd()),
|
relative(task.projectRoot ?? workspaceRoot, process.cwd()),
|
||||||
process.env.NX_VERBOSE_LOGGING === 'true'
|
process.env.NX_VERBOSE_LOGGING === 'true'
|
||||||
);
|
);
|
||||||
|
if (combinedOptions.env) {
|
||||||
|
env = {
|
||||||
|
...env,
|
||||||
|
...combinedOptions.env,
|
||||||
|
};
|
||||||
|
}
|
||||||
if (streamOutput) {
|
if (streamOutput) {
|
||||||
const args = getPrintableCommandArgsForTask(task);
|
const args = getPrintableCommandArgsForTask(task);
|
||||||
output.logCommand(args.join(' '));
|
output.logCommand(args.join(' '));
|
||||||
|
|||||||
@ -306,7 +306,7 @@ export function validateObject(
|
|||||||
) {
|
) {
|
||||||
Object.keys(opts).find((p) => {
|
Object.keys(opts).find((p) => {
|
||||||
if (
|
if (
|
||||||
Object.keys(schema.properties).indexOf(p) === -1 &&
|
Object.keys(schema.properties ?? {}).indexOf(p) === -1 &&
|
||||||
(!schema.patternProperties ||
|
(!schema.patternProperties ||
|
||||||
!Object.keys(schema.patternProperties).some((pattern) =>
|
!Object.keys(schema.patternProperties).some((pattern) =>
|
||||||
new RegExp(pattern).test(p)
|
new RegExp(pattern).test(p)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user