-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
run.test.ts
67 lines (59 loc) · 1.51 KB
/
run.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
import {
getPublishedVersion,
isNotWindows,
newProject,
readFile,
readJson,
runCLI,
runCLIAsync,
runCommand,
tmpProjPath,
uniq,
updateFile,
updateProjectConfig,
} from '@nrwl/e2e/utils';
import { renameSync } from 'fs';
import { packagesWeCareAbout } from 'nx/src/command-line/report';
//
describe('Running targets', () => {
beforeEach(() => newProject());
it('should execute long running tasks', async () => {
const myapp = uniq('myapp');
runCLI(`generate @nrwl/web:app ${myapp}`);
updateProjectConfig(myapp, (c) => {
c.targets['counter'] = {
executor: '@nrwl/workspace:counter',
options: {
to: 2,
},
};
return c;
});
const success = runCLI(`counter ${myapp} --result=true`);
expect(success).toContain('0');
expect(success).toContain('1');
expect(() => runCLI(`counter ${myapp} --result=false`)).toThrowError();
});
it('should run npm scripts', async () => {
const mylib = uniq('mylib');
runCLI(`generate @nrwl/node:lib ${mylib}`);
updateProjectConfig(mylib, (j) => {
delete j.targets;
return j;
});
updateFile(
`libs/${mylib}/package.json`,
JSON.stringify({
name: 'mylib1',
scripts: { 'echo:dev': `echo ECHOED` },
})
);
const { stdout } = await runCLIAsync(
`echo:dev ${mylib} -- positional --a=123 --no-b`,
{
silent: true,
}
);
expect(stdout).toMatch(/ECHOED positional --a=123 --no-b/);
}, 1000000);
});