File size: 491 Bytes
4e23b01
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { beforeEach } from 'vitest';

import { setCurrentKaos } from '#/current';
import { LocalKaos } from '#/local';

const kaos = await LocalKaos.create();

// Bind synchronously in `beforeEach`. `enterWith` mutates the running async
// context; vitest's test body is awaited next from the same chain, so it
// inherits the binding. An `await` inside `beforeEach` would push the bind
// into a child context that the test body wouldn't see.
beforeEach(() => {
  setCurrentKaos(kaos);
});