1
1
import { Compiler } from '../src' ;
2
- import { existsSync } from 'fs' ;
2
+ import { existsSync , rmSync , rmdirSync } from 'fs' ;
3
3
import { join } from 'path' ;
4
- import { remove , readFileSync } from 'fs-extra' ;
4
+ import { readFileSync } from 'fs-extra' ;
5
5
6
6
describe ( '/test/index.test.ts' , ( ) => {
7
7
it ( 'test generate ts interface' , async ( ) => {
@@ -32,10 +32,10 @@ describe('/test/index.test.ts', () => {
32
32
expect ( content . includes ( 'addMany(options?: grpc.IClientOptions): grpc.IClientWritableStreamService<AddArgs, Num>;' ) ) . toBeTruthy ( ) ;
33
33
expect ( content . includes ( 'addEmpty(options?: grpc.IClientOptions): grpc.IClientUnaryService<any, any>;' ) ) . toBeTruthy ( ) ;
34
34
35
- await remove ( join ( __dirname , './fixtures/common/test/hero.ts' ) ) ;
36
- await remove ( join ( __dirname , './fixtures/common/helloworld.ts' ) ) ;
37
- await remove ( join ( __dirname , './fixtures/common/math.ts' ) ) ;
38
- await remove ( join ( __dirname , './fixtures/common/hello_stream.ts' ) ) ;
35
+ rmSync ( join ( __dirname , './fixtures/common/test/hero.ts' ) ) ;
36
+ rmSync ( join ( __dirname , './fixtures/common/helloworld.ts' ) ) ;
37
+ rmSync ( join ( __dirname , './fixtures/common/math.ts' ) ) ;
38
+ rmSync ( join ( __dirname , './fixtures/common/hello_stream.ts' ) ) ;
39
39
} ) ;
40
40
41
41
it ( 'test generate ts interface to specified directory' , async ( ) => {
@@ -52,7 +52,7 @@ describe('/test/index.test.ts', () => {
52
52
expect ( existsSync ( join ( __dirname , './fixtures/common/domain/helloworld.ts' ) ) ) . toBeTruthy ( ) ;
53
53
expect ( existsSync ( join ( __dirname , './fixtures/common/domain/math.ts' ) ) ) . toBeTruthy ( ) ;
54
54
55
- await remove ( join ( __dirname , './fixtures/common/domain' ) ) ;
55
+ rmdirSync ( join ( __dirname , './fixtures/common/domain' ) ) ;
56
56
} ) ;
57
57
58
58
it ( 'test generate ts interface to specified directory with reserve directory' , async ( ) => {
@@ -70,7 +70,7 @@ describe('/test/index.test.ts', () => {
70
70
expect ( existsSync ( join ( __dirname , './fixtures/common/domain/helloworld.ts' ) ) ) . toBeTruthy ( ) ;
71
71
expect ( existsSync ( join ( __dirname , './fixtures/common/domain/math.ts' ) ) ) . toBeTruthy ( ) ;
72
72
73
- await remove ( join ( __dirname , './fixtures/common/domain' ) ) ;
73
+ rmdirSync ( join ( __dirname , './fixtures/common/domain' ) ) ;
74
74
} ) ;
75
75
76
76
it ( 'test generate ts interface keep case' , async ( ) => {
@@ -88,7 +88,7 @@ describe('/test/index.test.ts', () => {
88
88
const content = readFileSync ( join ( __dirname , './fixtures/keep_case/domain/helloworld_keep_case.ts' ) , 'utf8' ) ;
89
89
expect ( content . includes ( 'key_filed' ) ) . toBeTruthy ( ) ;
90
90
91
- await remove ( join ( __dirname , './fixtures/keep_case/domain' ) ) ;
91
+ rmdirSync ( join ( __dirname , './fixtures/keep_case/domain' ) ) ;
92
92
} ) ;
93
93
94
94
it . skip ( 'test fix issue 999' , async ( ) => {
@@ -119,6 +119,6 @@ describe('/test/index.test.ts', () => {
119
119
expect ( ! content . includes ( 'namespace base' ) ) . toBeTruthy ( ) ;
120
120
expect ( ! content . includes ( 'namespace gogo' ) ) . toBeTruthy ( ) ;
121
121
122
- await remove ( join ( __dirname , './fixtures/issue999/domain' ) ) ;
122
+ rmdirSync ( join ( __dirname , './fixtures/issue999/domain' ) ) ;
123
123
} ) ;
124
124
} ) ;
0 commit comments