Skip to content

expect expectAsync Factory

Christopher Hiller edited this page Sep 2, 2025 · 1 revision

I want a factory function for expect() and expectAsync().

Let's call this function bootstrap(). It should live in src/bootstrap.ts. The code in src/expect.ts and src/expect-async.ts should move into this file.

bootstrap() will return an object with shape:

{
  expect: Expect,
  expectAsync: ExpectAsync
}

This object will be destructured and exported from src/bootstrap.ts, then re-exported from src/index.ts as the expect and expectAsync functions.

There will be references to src/expect.js and src/expect-async.js in tests and perhaps other files; these will need to be updated to point at src/bootstrap.js. Other modules should not import anything from src/index.ts / src/index.js.

Clone this wiki locally