-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
update-swcrc-path.spec.ts
34 lines (31 loc) · 1.1 KB
/
update-swcrc-path.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {
addProjectConfiguration,
readProjectConfiguration,
} from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import updateSwcrcPath from './update-swcrc-path';
describe('update-swcrc-path migration', () => {
it('should replace relative `swcrcPath` option with absolute `swcrc`', async () => {
const tree = createTreeWithEmptyWorkspace(2);
addProjectConfiguration(tree, 'test-package', {
root: 'packages/test-package',
targets: {
build: {
executor: '@nrwl/js:swc',
options: {
swcrcPath: 'config/swcrc.json',
somethingThatShouldNotBeRemoved: true,
},
},
},
});
await updateSwcrcPath(tree);
const { targets, root } = readProjectConfiguration(tree, 'test-package');
expect(root).toBe('packages/test-package');
expect(targets.build.options.somethingThatShouldNotBeRemoved).toBeDefined();
expect(targets.build.options.swcrcPath).toBeUndefined();
expect(targets.build.options.swcrc).toBe(
'packages/test-package/config/swcrc.json'
);
});
});