fix(test): isolate jsdom storage on Node 26
This commit is contained in:
14
scripts/vitest-environment.compat.spec.ts
Normal file
14
scripts/vitest-environment.compat.spec.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// @vitest-environment jsdom
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
describe('Vitest jsdom compatibility', () => {
|
||||
it('provides isolated browser storage instead of Node process storage', () => {
|
||||
if (process.allowedNodeEnvironmentFlags.has('--webstorage')) {
|
||||
expect(process.execArgv.filter(argument => argument === '--no-webstorage')).toHaveLength(1)
|
||||
}
|
||||
localStorage.setItem('dsh-vitest-storage-probe', 'available')
|
||||
|
||||
expect(localStorage.getItem('dsh-vitest-storage-probe')).toBe('available')
|
||||
localStorage.removeItem('dsh-vitest-storage-probe')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user