Skip to content

Commit 6665dad

Browse files
committed
test: use fs.rmSync() and rmdirSync()
1 parent 769ba7b commit 6665dad

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/index.test.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Compiler } from '../src';
2-
import { existsSync } from 'fs';
2+
import { existsSync, rmSync, rmdirSync } from 'fs';
33
import { join } from 'path';
4-
import { remove, readFileSync } from 'fs-extra';
4+
import { readFileSync } from 'fs-extra';
55

66
describe('/test/index.test.ts', () => {
77
it('test generate ts interface', async () => {
@@ -32,10 +32,10 @@ describe('/test/index.test.ts', () => {
3232
expect(content.includes('addMany(options?: grpc.IClientOptions): grpc.IClientWritableStreamService<AddArgs, Num>;')).toBeTruthy();
3333
expect(content.includes('addEmpty(options?: grpc.IClientOptions): grpc.IClientUnaryService<any, any>;')).toBeTruthy();
3434

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'));
3939
});
4040

4141
it('test generate ts interface to specified directory', async () => {
@@ -52,7 +52,7 @@ describe('/test/index.test.ts', () => {
5252
expect(existsSync(join(__dirname, './fixtures/common/domain/helloworld.ts'))).toBeTruthy();
5353
expect(existsSync(join(__dirname, './fixtures/common/domain/math.ts'))).toBeTruthy();
5454

55-
await remove(join(__dirname, './fixtures/common/domain'));
55+
rmdirSync(join(__dirname, './fixtures/common/domain'));
5656
});
5757

5858
it('test generate ts interface to specified directory with reserve directory', async () => {
@@ -70,7 +70,7 @@ describe('/test/index.test.ts', () => {
7070
expect(existsSync(join(__dirname, './fixtures/common/domain/helloworld.ts'))).toBeTruthy();
7171
expect(existsSync(join(__dirname, './fixtures/common/domain/math.ts'))).toBeTruthy();
7272

73-
await remove(join(__dirname, './fixtures/common/domain'));
73+
rmdirSync(join(__dirname, './fixtures/common/domain'));
7474
});
7575

7676
it('test generate ts interface keep case', async () => {
@@ -88,7 +88,7 @@ describe('/test/index.test.ts', () => {
8888
const content = readFileSync(join(__dirname, './fixtures/keep_case/domain/helloworld_keep_case.ts'), 'utf8');
8989
expect(content.includes('key_filed')).toBeTruthy();
9090

91-
await remove(join(__dirname, './fixtures/keep_case/domain'));
91+
rmdirSync(join(__dirname, './fixtures/keep_case/domain'));
9292
});
9393

9494
it.skip('test fix issue 999', async () => {
@@ -119,6 +119,6 @@ describe('/test/index.test.ts', () => {
119119
expect(!content.includes('namespace base')).toBeTruthy();
120120
expect(!content.includes('namespace gogo')).toBeTruthy();
121121

122-
await remove(join(__dirname, './fixtures/issue999/domain'));
122+
rmdirSync(join(__dirname, './fixtures/issue999/domain'));
123123
});
124124
});

0 commit comments

Comments
 (0)