Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Nov 15, 2023
1 parent 440efce commit f8ffa7b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion packages/vitest/src/integrations/mock/timers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {
import {
withGlobal,
} from '@sinonjs/fake-timers'
import { isChildProcess } from '../../utils/base'
import { RealDate, mockDate, resetDate } from './date'

export class FakeTimers {
Expand Down Expand Up @@ -134,7 +135,7 @@ export class FakeTimers {
// Do not mock nextTick by default. It can still be mocked through userConfig.
.filter(timer => timer !== 'nextTick') as (keyof FakeTimerWithContext['timers'])[]

if (this._userConfig?.toFake?.includes('nextTick') && process.send)
if (this._userConfig?.toFake?.includes('nextTick') && isChildProcess())
throw new Error('process.nextTick cannot be mocked inside child_process')

this._clock = this._fakeTimers.install({
Expand Down
10 changes: 5 additions & 5 deletions packages/vitest/src/node/pools/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ export function createMethodsRPC(project: WorkspaceProject): RuntimeRPC {
},
onPathsCollected(paths) {
ctx.state.collectPaths(paths)
project.report('onPathsCollected', paths)
ctx.report('onPathsCollected', paths)
},
onCollected(files) {
ctx.state.collectFiles(files)
project.report('onCollected', files)
ctx.report('onCollected', files)
},
onAfterSuiteRun(meta) {
ctx.coverageProvider?.onAfterSuiteRun(meta)
},
onTaskUpdate(packs) {
ctx.state.updateTasks(packs)
project.report('onTaskUpdate', packs)
ctx.report('onTaskUpdate', packs)
},
onUserConsoleLog(log) {
ctx.state.updateUserLog(log)
project.report('onUserConsoleLog', log)
ctx.report('onUserConsoleLog', log)
},
onUnhandledError(err, type) {
ctx.state.catchError(err, type)
},
onFinished(files) {
project.report('onFinished', files, ctx.state.getUnhandledErrors())
ctx.report('onFinished', files, ctx.state.getUnhandledErrors())
},
onCancel(reason) {
ctx.cancelCurrentRun(reason)
Expand Down
4 changes: 0 additions & 4 deletions packages/vitest/src/node/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,6 @@ export class WorkspaceProject {
await this.initBrowserServer(this.server.config.configFile)
}

async report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>) {
return this.ctx.report(name, ...args)
}

isBrowserEnabled() {
return isBrowserEnabled(this.config)
}
Expand Down

0 comments on commit f8ffa7b

Please sign in to comment.