Skip to content

ObsidianPluginVitestConfigContext.globalStubTestFiles

ObsidianPluginVitestConfigContext › globalStubTestFiles

Type: string[]

The unit test files that redefine window, document, location or top, which the unit-tests project's VM pool cannot run.

Under pool: 'vmThreads' those four are non-configurable properties of the VM global, so vi.stubGlobal('window', …) or Object.defineProperty(window, 'location', …) throws Cannot redefine property. That is JS semantics, not a bug to route around. Every other global stays configurable and stubs normally.

Push a file here and it leaves unit-tests for a sibling unit-tests:global-stubs project that is identical except for the pool, which is the default one. A plugin's test and test:coverage scripts name unit-tests, which also selects every unit-tests:* project, so the sibling runs and is covered without a script change. It is emitted only when this list is non-empty.

To keep a whole suite on the default pool instead, set unitTests.pool to 'forks' and say why.