-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcli.test.ts
67 lines (41 loc) · 2.03 KB
/
cli.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 {describe, expect, test, vi} from 'vitest'
import {_spawnProject} from './_spawnProject'
describe('cli', () => {
vi.setConfig({testTimeout: 60000})
test('run `etl` command', async () => {
const project = await _spawnProject('mylib')
await project.install()
await project.run('build')
expect(await project.dirs()).toEqual(['dist', 'node_modules', 'src'])
const {stdout} = await project.run('etl')
expect(await project.dirs()).toEqual(['dist', 'node_modules', 'src'])
expect(stdout).toContain('wrote 25 documents to ../../etc/mylib/1.0.0.json')
})
test.skip('run `etl` command in `mylib-bundling-ts`', async () => {
const project = await _spawnProject('mylib-bundling-ts')
await project.install()
await project.run('build')
expect(await project.dirs()).toEqual(['dist', 'node_modules', 'src'])
const {stdout} = await project.run('etl')
expect(await project.dirs()).toEqual(['dist', 'node_modules', 'src'])
expect(stdout).toContain('wrote 27 documents to ../../etc/mylib-bundling-ts/1.0.0.json')
})
test('run `etl` command in `multi-export`', async () => {
const project = await _spawnProject('multi-export')
await project.install()
await project.run('build')
expect(await project.dirs()).toEqual(['dist', 'exports', 'node_modules', 'src'])
const {stdout} = await project.run('etl')
expect(await project.dirs()).toEqual(['dist', 'exports', 'node_modules', 'src'])
expect(stdout).toContain('wrote 10 documents to ../../etc/multi-export/1.0.0.json')
})
test('run `etl` command in `multi-export-cjs`', async () => {
const project = await _spawnProject('multi-export-cjs')
await project.install()
await project.run('build')
expect(await project.dirs()).toEqual(['dist', 'exports', 'node_modules', 'src'])
const {stdout} = await project.run('etl')
expect(await project.dirs()).toEqual(['dist', 'exports', 'node_modules', 'src'])
expect(stdout).toContain('wrote 10 documents to ../../etc/multi-export-cjs/1.0.0.json')
})
})