-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Labels
bun:testSomething related to the `bun test` runnerSomething related to the `bun test` runnerenhancementNew feature or requestNew feature or request
Description
What is the problem this feature would solve?
Leaks across files.
Example:
// data.ts
export const data = {
name: 'User',
}// test1.test.ts
import { expect, test } from 'bun:test'
import { data } from './data'
data.name = 'Admin'
test('test-1', () => {
expect(data).toEqual({
name: 'Admin',
})
})// test2.test.ts
import { expect, test } from 'bun:test'
import { data } from './data'
test('test-2', () => {
expect(data).toEqual({
name: 'User',
})
})test2 will fail because the data has been modified in test1.
bun test v1.0.3 (25e69c71)
test/test1.test.ts:
✓ test-1 [0.08ms]
test/test2.test.ts:
1 | import { expect, test } from 'bun:test'
2 | import { data } from './data'
3 |
4 | test('test-2', () => {
5 | expect(data).toEqual({
^
error: expect(received).toEqual(expected)
{
+ name: "Admin"
- name: "User"
}
- Expected - 1
+ Received + 1In vitest and jest, both tests pass.
What is the feature you are proposing to solve the problem?
Isolated by default, but can be disabled using a parameter.
Ref: https://vitest.dev/config/isolate.html
What alternatives have you considered?
No response
ImLunaHey, cayter, erwinstone, J3m5, saasc3l and 20 more
Metadata
Metadata
Assignees
Labels
bun:testSomething related to the `bun test` runnerSomething related to the `bun test` runnerenhancementNew feature or requestNew feature or request