···257257258258 importFile = async (filepath: string, mode: 'collect' | 'setup') => {
259259 let hash = this.hashMap.get(filepath)
260260- if (!hash) {
260260+261261+ // if the mode is setup, we need to re-evaluate the setup file on each test run
262262+ if (mode === 'setup' || !hash) {
261263 hash = Date.now().toString()
262264 this.hashMap.set(filepath, hash)
263265 }
···11+import { expect, test } from 'vitest'
22+import { counter } from './counter'
33+44+test('make sure the counter is reset by the setup file beforeEach hook', () => {
55+ counter.increment()
66+ expect(counter.get()).toBe(1)
77+});