Skip to content

Commit

Permalink
fix(testing): target defaults migration should not throw if workspace…
Browse files Browse the repository at this point in the history
… contains inferred projects (nrwl#20189)
  • Loading branch information
AgentEnder authored Nov 10, 2023
1 parent e4cb6c1 commit fec681b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -559,4 +559,46 @@ describe('move-options-to-target-defaults migration', () => {
},
});
});

it("should't error if a project is present in the graph but not using project.json", async () => {
projectGraph.nodes['csproj'] = {
name: 'csproj',
type: 'lib',
data: {
root: 'csproj',
targets: {
build: {
command: 'echo HELLO',
},
},
},
};
addProjectConfiguration(tree, 'proj1', {
root: 'proj1',
targets: {
test: {
executor: '@nx/jest:jest',
options: {
jestConfig: 'jest.config.js',
passWithNoTests: true,
},
configurations: {
ci: {
ci: true,
codeCoverage: true,
},
},
},
},
});
updateNxJson(tree, {
targetDefaults: {
build: {
inputs: ['default', '^production'],
},
},
});
const promise = update(tree);
await expect(promise).resolves.not.toThrow();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function isTargetDefaultUsed(
targetName,
targetDefaults,
// It might seem like we should use the graph here too but we don't want to pass an executor which was processed in the graph
projectMap.get(p.name).targets?.[targetName]?.executor
projectMap.get(p.name)?.targets?.[targetName]?.executor
) === targetDefault
) {
return true;
Expand Down

0 comments on commit fec681b

Please sign in to comment.