Skip to content

Commit

Permalink
fix(misc): migration for run-commands output-path should handle null … (
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder authored May 15, 2023
1 parent b02d169 commit a81b90b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ describe('removeRunCommandsOutputPath', () => {
expect(migratedTargets.other).toEqual(startingTargets.other);
});

it('should handle null options correctly', () => {
const tree = createTreeWithEmptyWorkspace();
const startingTargets: Record<string, TargetConfiguration> = {
build: {
executor: 'nx:run-commands',
outputs: ['dist/some/path'],
},
};
addProjectConfiguration(tree, 'my-app', {
root: 'apps/my-app',
targets: startingTargets,
});
expect(() => removeRunCommandsOutputPath(tree)).not.toThrow();
const migratedTargets = readProjectConfiguration(tree, 'my-app').targets;
expect(migratedTargets.build).toEqual(startingTargets.build);
expect(migratedTargets.other).toEqual(startingTargets.other);
});

it('should migrate target defaults correctly', () => {
const tree = createTreeWithEmptyWorkspace();
const startingTargetDefaults: Record<string, TargetConfiguration> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default async function removeRunCommandsOutputPath(tree: Tree) {

function updateTargetBlock(target: TargetConfiguration): boolean {
let changed = false;
if (target.executor === 'nx:run-commands' && target.options.outputPath) {
if (target.executor === 'nx:run-commands' && target.options?.outputPath) {
changed = true;
const outputs = new Set(target.outputs ?? []);
outputs.delete('{options.outputPath}');
Expand Down

1 comment on commit a81b90b

@vercel
Copy link

@vercel vercel bot commented on a81b90b May 15, 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
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app

Please sign in to comment.