/
add-outputs.spec.ts
69 lines (63 loc) · 1.53 KB
/
add-outputs.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
import {
addProjectConfiguration,
readProjectConfiguration,
TargetConfiguration,
Tree,
} from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import addOutputs from './add-outputs';
describe('addOutputs', () => {
let tree: Tree;
beforeEach(() => {
tree = createTreeWithEmptyWorkspace();
const lintWithoutOutputs: TargetConfiguration = {
executor: '@nrwl/linter:eslint',
options: {},
};
const lintWithOutputs: TargetConfiguration = {
executor: '@nrwl/linter:eslint',
outputs: ['dist'],
options: {},
};
const notLint: TargetConfiguration = {
executor: '@nrwl/node:build',
options: {},
};
addProjectConfiguration(tree, 'proj', {
root: 'proj',
targets: {
lintWithoutOutputs,
lintWithOutputs,
notLint,
},
});
});
it('should add outputs to targets that do not have outputs', async () => {
await addOutputs(tree);
expect(readProjectConfiguration(tree, 'proj')).toMatchInlineSnapshot(`
Object {
"root": "proj",
"targets": Object {
"lintWithOutputs": Object {
"executor": "@nrwl/linter:eslint",
"options": Object {},
"outputs": Array [
"dist",
],
},
"lintWithoutOutputs": Object {
"executor": "@nrwl/linter:eslint",
"options": Object {},
"outputs": Array [
"{options.outputFile}",
],
},
"notLint": Object {
"executor": "@nrwl/node:build",
"options": Object {},
},
},
}
`);
});
});