Open lukeed opened 1 year ago
For anyone looking to workaround this to test in multiple runtimes, what you can do for now is pass import.meta and use it to declare bun's test function.
export function createTest(meta) {
return Bun.jest(meta.path).test
}
// a.js
const test = createTest(import.meta)
test(...)
// b.js
const test = createTest(import.meta)
test(...)
I used this principle in a slightly nicer api to create a lib that can be used to define tests that run with Bun, Node and Deno's native runners (https://github.com/benmerckx/suite)
What version of Bun is running?
1.0.1+31aec4ebe325982fc0ef27498984b0ad9969162
What platform is your computer?
Darwin 21.3.0 arm64 arm
What steps can reproduce the bug?
Then
bun test demo
What is the expected behavior?
The
foobar.test.ts
should be treated exactly the same asindex.test.ts
What do you see instead?
Additional information
This happens with
describe
,test
/it
, andexpect
(so far)With
expect
, for example, the sameCannot find package "test"
error appears, so my hunch is that on-the-fly transpilation is dropping thebun:
namespace & looking for thetest
node_module.