1
1
import test from 'ava'
2
- import { execSync } from 'child_process'
3
- import { readFileSync , unlinkSync } from 'fs'
2
+ import { execSync } from 'child_process'
3
+ import { readFileSync , unlinkSync } from 'fs'
4
4
5
5
export function run ( ) {
6
-
7
6
test ( 'pipe in, pipe out' , t => {
8
7
t . snapshot (
9
- execSync ( 'shx cat ./test/resources/ReferencedType.json | node dist/src/cli.js' , { encoding : 'utf-8' } ) . toString ( )
8
+ execSync ( 'shx cat ./test/resources/ReferencedType.json | node dist/src/cli.js' , { encoding : 'utf-8' } ) . toString ( )
10
9
)
11
10
} )
12
11
13
12
test ( 'pipe in (schema without ID), pipe out' , t => {
14
13
t . snapshot (
15
- execSync ( 'shx cat ./test/resources/ReferencedTypeWithoutID.json | node dist/src/cli.js' , { encoding : 'utf-8' } ) . toString ( )
14
+ execSync ( 'shx cat ./test/resources/ReferencedTypeWithoutID.json | node dist/src/cli.js' , {
15
+ encoding : 'utf-8'
16
+ } ) . toString ( )
16
17
)
17
18
} )
18
19
19
20
test ( 'file in (no flags), pipe out' , t => {
20
- t . snapshot (
21
- execSync ( 'node dist/src/cli.js ./test/resources/ReferencedType.json' ) . toString ( )
22
- )
21
+ t . snapshot ( execSync ( 'node dist/src/cli.js ./test/resources/ReferencedType.json' ) . toString ( ) )
23
22
} )
24
23
25
24
test ( 'file in (--input), pipe out' , t => {
26
- t . snapshot (
27
- execSync ( 'node dist/src/cli.js --input ./test/resources/ReferencedType.json' ) . toString ( )
28
- )
25
+ t . snapshot ( execSync ( 'node dist/src/cli.js --input ./test/resources/ReferencedType.json' ) . toString ( ) )
29
26
} )
30
27
31
28
test ( 'file in (-i), pipe out' , t => {
32
- t . snapshot (
33
- execSync ( 'node dist/src/cli.js -i ./test/resources/ReferencedType.json' ) . toString ( )
34
- )
29
+ t . snapshot ( execSync ( 'node dist/src/cli.js -i ./test/resources/ReferencedType.json' ) . toString ( ) )
35
30
} )
36
31
37
32
test ( 'file in (-i), unreachable definitions flag, pipe out' , t => {
@@ -47,13 +42,13 @@ export function run() {
47
42
} )
48
43
49
44
test ( 'file in (-i), pipe out (absolute path)' , t => {
50
- t . snapshot (
51
- execSync ( `node dist/src/cli.js -i ${ __dirname } /../../test/resources/ReferencedType.json` ) . toString ( )
52
- )
45
+ t . snapshot ( execSync ( `node dist/src/cli.js -i ${ __dirname } /../../test/resources/ReferencedType.json` ) . toString ( ) )
53
46
} )
54
47
55
48
test ( 'pipe in, file out (--output)' , t => {
56
- execSync ( 'shx cat ./test/resources/ReferencedType.json | node dist/src/cli.js --output ./ReferencedType.d.ts' ) . toString ( )
49
+ execSync (
50
+ 'shx cat ./test/resources/ReferencedType.json | node dist/src/cli.js --output ./ReferencedType.d.ts'
51
+ ) . toString ( )
57
52
t . snapshot ( readFileSync ( './ReferencedType.d.ts' , 'utf-8' ) )
58
53
unlinkSync ( './ReferencedType.d.ts' )
59
54
} )
@@ -77,9 +72,10 @@ export function run() {
77
72
} )
78
73
79
74
test ( 'file in (--input), file out (--output)' , t => {
80
- execSync ( 'node dist/src/cli.js --input ./test/resources/ReferencedType.json --output ./ReferencedType.d.ts' ) . toString ( )
75
+ execSync (
76
+ 'node dist/src/cli.js --input ./test/resources/ReferencedType.json --output ./ReferencedType.d.ts'
77
+ ) . toString ( )
81
78
t . snapshot ( readFileSync ( './ReferencedType.d.ts' , 'utf-8' ) )
82
79
unlinkSync ( './ReferencedType.d.ts' )
83
80
} )
84
-
85
81
}
0 commit comments