Skip to content

Commit

Permalink
fix(core): apply target defaults properly for executors defaults (#18655
Browse files Browse the repository at this point in the history
)
  • Loading branch information
FrozenPandaz authored Aug 16, 2023
1 parent 8890040 commit f670e74
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,32 @@ describe('workspace-projects', () => {
).toEqual({ a: 'a', b: 'my/project' });
});

it('should merge options when targets use executors with defaults', () => {
expect(
normalizeProjectTargets(
{
root: 'my/project',
targets: {
build: {
executor: '@nx/jest:jest',
options: {
a: 'a',
},
},
},
},
{
'@nx/jest:jest': {
options: {
b: 'b',
},
},
},
'build'
).build.options
).toEqual({ a: 'a', b: 'b' });
});

it('should not merge options when targets use different executors', () => {
expect(
normalizeProjectTargets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ export function normalizeProjectTargets(
// We need to know the executor for use in readTargetDefaultsForTarget,
// but we haven't resolved the `command` syntactic sugar yet.
const executor =
targets[target].executor ?? targets[target].command
? 'nx:run-commands'
: null;
targets[target].executor ??
(targets[target].command ? 'nx:run-commands' : null);

// Allows things like { targetDefaults: { build: { command: tsc } } }
const defaults = resolveCommandSyntacticSugar(
Expand Down

1 comment on commit f670e74

@vercel
Copy link

@vercel vercel bot commented on f670e74 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx.dev
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app

Please sign in to comment.