Skip to content

Commit 5ade4a8

Browse files
authored
fix: vitest to fail to exit properly in ci, close #119 (#121)
1 parent 31cb96b commit 5ade4a8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

plugin/src/core/mockCompiler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class MockCompiler extends EventEmitter {
4646
return this._mockData
4747
}
4848

49-
run(): void {
49+
run(watch?: boolean): void {
5050
const { include, exclude } = this.options
5151
/**
5252
* 使用 rollup 提供的 include/exclude 规则,
@@ -68,6 +68,9 @@ export class MockCompiler extends EventEmitter {
6868
.then(loadList => promiseParallel(loadList, 10))
6969
.then(() => this.updateMockList())
7070

71+
if (!watch)
72+
return
73+
7174
this.watchMockEntry()
7275
this.watchDeps()
7376

plugin/src/core/mockMiddleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function mockServerMiddleware(
2323
*/
2424
const compiler = createMockCompiler(options)
2525

26-
compiler.run()
26+
compiler.run(!!server)
2727

2828
/**
2929
* 监听 mock 文件是否发生变更,如何配置了 reload 为 true,

0 commit comments

Comments
 (0)