/
bazel.test.ts
83 lines (71 loc) · 2.47 KB
/
bazel.test.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
79
80
81
82
83
import {
checkFilesExist,
ensureProject,
forEachCli,
readFile,
runCLI,
runCommand,
uniq,
updateFile
} from './utils';
forEachCli(currentCLIName => {
describe('Bazel', () => {
const ngapp = uniq('ngapp');
const reactapp = uniq('reactapp');
const nglib = uniq('nglib');
const reactlib = uniq('reactlib');
it('noop', () => {});
xit('should generate build files for apps', () => {
ensureProject();
runCLI(`generate @nrwl/angular:app ${ngapp}`);
runCLI('generate @nrwl/bazel:sync');
checkFilesExist(`apps/${ngapp}/BUILD.bazel`);
runCLI(`generate @nrwl/react:app ${reactapp}`);
runCLI('generate @nrwl/bazel:sync');
checkFilesExist(`apps/${reactapp}/BUILD.bazel`);
});
xit('should generate build files for libs', () => {
runCLI(`generate @nrwl/angular:lib ${nglib}`);
runCLI('generate @nrwl/bazel:sync');
checkFilesExist(`libs/${nglib}/BUILD.bazel`);
runCLI(`generate @nrwl/angular:lib ${reactlib}`);
runCLI('generate @nrwl/bazel:sync');
checkFilesExist(`libs/${reactlib}/BUILD.bazel`);
});
xit('should add dependencies to build files', () => {
updateFile(`apps/${ngapp}/src/main.ts`, `import '@proj/${nglib}';`);
runCLI('generate @nrwl/bazel:sync');
expect(readFile(`apps/${ngapp}/BUILD.bazel`)).toContain(
`//libs/${nglib}:${nglib}`
);
updateFile(`apps/${reactapp}/src/main.ts`, `import '@proj/${reactlib}';`);
runCLI('generate @nrwl/bazel:sync');
expect(readFile(`apps/${reactapp}/BUILD.bazel`)).toContain(
`//libs/${reactlib}:${reactlib}`
);
});
xit('should be able to lint projects with bazel', () => {
const lintResult = runCommand(
`./node_modules/.bin/bazel test //apps/${ngapp}:lint`
);
expect(lintResult).toContain('PASSED');
});
xit('should be able to build projects with bazel', () => {
const buildResult = runCommand(
`./node_modules/.bin/bazel build //apps/${ngapp}:build`
);
});
xit('should be able to test projects with bazel', () => {
const testResult = runCommand(
`./node_modules/.bin/bazel test //apps/${ngapp}:test`
);
expect(testResult).toContain('PASSED');
});
xit('should be able to e2e test projects with bazel', () => {
const e2eResult = runCommand(
`./node_modules/.bin/bazel test //apps/${ngapp}-e2e:e2e`
);
expect(e2eResult).toContain('PASSED');
});
});
});