forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.test.ts
More file actions
32 lines (28 loc) · 777 Bytes
/
cli.test.ts
File metadata and controls
32 lines (28 loc) · 777 Bytes
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
import * as fs from 'fs';
import * as path from 'path';
import { spawnSync } from 'child_process';
const PROJECT_ROOT = path.resolve(__dirname, '../..');
describe('cli - lowcode-code-generator', () => {
it('should works', () => {
const res = spawnSync('node bin/lowcode-code-generator --solution icejs example-schema.json', {
shell: true,
stdio: 'pipe',
encoding: 'utf8',
cwd: PROJECT_ROOT,
});
expect({
status: res.status,
stdout: res.stdout,
stderr: res.stderr,
}).toMatchInlineSnapshot(`
Object {
"status": 0,
"stderr": "",
"stdout": "",
}
`);
expect(
fs.existsSync(path.join(PROJECT_ROOT, 'generated/src/pages/Test/index.jsx')),
).toBeTruthy();
});
});