diff --git a/test/config/store.test.ts b/test/config/store.test.ts index cc96fdaf..d3052007 100644 --- a/test/config/store.test.ts +++ b/test/config/store.test.ts @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, afterEach } from 'node:test' +import { describe, it, beforeEach, afterEach } from 'node:test' import assert from 'node:assert/strict' -import { setResolvedConfig, getResolvedConfig } from '../../src/config/store.ts' +import { setResolvedConfig, getResolvedConfig, _testResetConfig } from '../../src/config/store.ts' import type { ResolvedConfig } from '../../src/config/types.ts' const sampleConfig: ResolvedConfig = { @@ -14,9 +14,15 @@ const sampleConfig: ResolvedConfig = { }, } +// The store is a module-level singleton. Under `bun test` all files share one +// process, so other suites can leave state behind; reset before each test (not +// just after) so assertions about the initial state are order-independent. +beforeEach(() => { + _testResetConfig() +}) + afterEach(() => { - // reset singleton state between tests - setResolvedConfig(undefined as unknown as ResolvedConfig) + _testResetConfig() }) describe('store', () => {