/
update-10-2-0.spec.ts
78 lines (73 loc) · 2.4 KB
/
update-10-2-0.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { Tree } from '@angular-devkit/schematics';
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import { serializeJson } from '@nrwl/workspace';
import { createEmptyWorkspace } from '@nrwl/workspace/testing';
import * as path from 'path';
describe('update 10.2.0', () => {
let initialTree: Tree;
let schematicRunner: SchematicTestRunner;
beforeEach(() => {
initialTree = createEmptyWorkspace(Tree.empty());
initialTree.overwrite(
'workspace.json',
serializeJson({
version: 1,
projects: {
products: {
root: 'apps/products',
sourceRoot: 'apps/products/src',
architect: {
build: {
builder: '@angular-devkit/build-angular:browser',
},
test: {
builder: '@nrwl/jest:jest',
options: {
jestConfig: 'apps/products/jest.config.js',
tsConfig: 'apps/products/tsconfig.spec.json',
setupFile: 'apps/products/src/test-setup.ts',
passWithNoTests: true,
},
},
},
},
cart: {
root: 'apps/cart',
sourceRoot: 'apps/cart/src',
architect: {
build: {
builder: '@nrwl/web:build',
},
test: {
builder: '@nrwl/jest:jest',
options: {
jestConfig: 'apps/cart/jest.config.js',
passWithNoTests: true,
},
},
},
},
},
})
);
schematicRunner = new SchematicTestRunner(
'@nrwl/jest',
path.join(__dirname, '../../../migrations.json')
);
});
it('should remove setupFile and tsconfig in test architect from workspace.json', async (done) => {
const result = await schematicRunner
.runSchematicAsync('update-10.2.0', {}, initialTree)
.toPromise();
const updatedWorkspace = JSON.parse(result.readContent('workspace.json'));
expect(updatedWorkspace.projects.products.architect.test.options).toEqual({
jestConfig: expect.anything(),
passWithNoTests: expect.anything(),
});
expect(updatedWorkspace.projects.cart.architect.test.options).toEqual({
jestConfig: expect.anything(),
passWithNoTests: expect.anything(),
});
done();
});
});