Skip to content

Commit

Permalink
fix(core): workspace remove generator should handle no root jest conf…
Browse files Browse the repository at this point in the history
…ig (#23328)
  • Loading branch information
Coly010 authored May 13, 2024
1 parent 7561e71 commit 4f31608
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,24 @@ describe('updateRootJestConfig', () => {

expect(rootJestConfig).toMatchSnapshot();
});

it('should handle not having a root jest config file', async () => {
// ARRANGE
tree.delete('jest.config.ts');

await libraryGenerator(tree, {
name: 'test',
bundler: 'vite',
unitTestRunner: 'vitest',
});

// ACT
expect(() =>
updateJestConfig(
tree,
{ projectName: 'test', skipFormat: false, forceRemove: false },
readProjectConfiguration(tree, 'test')
)
).not.toThrow();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export function updateJestConfig(
const rootConfigPath = findRootJestConfig(tree);

if (
!rootConfigPath ||
!tree.exists(rootConfigPath) ||
!tree.exists(join(projectConfig.root, 'jest.config.ts')) ||
isUsingUtilityFunction(tree) ||
Expand Down

0 comments on commit 4f31608

Please sign in to comment.