Trouble testing durable objects with latest wrangler and miniflare/jest in ts

Hi! I added a durable object to my worker project and it's broken my tests. All of my tests now fail before running with DurableObjectError [ERR_CLASS_NOT_FOUND]: Class "DurableThing" for Durable Object "DURABLE_THING" not found. I checked the compiler output and the DurableThing class is not present in the output, which explains why jest/miniflare don't see it. Doing const r = DurableThing; in my worker doesn't cause it to be included in the compiler output. Here's my jest config from packages.json:
"jest": {
"preset": "ts-jest",
"testEnvironment": "miniflare",
"testMatch": [
"**/*.test.ts"
],
"testEnvironmentOptions": {
"modules": true,
"scriptPath": "dist/worker.js",
"r2Buckets": [
"R2_BUCKET"
],
"durableObjects": {
"DURABLE_THING": "DurableThing"
}
}
}
"jest": {
"preset": "ts-jest",
"testEnvironment": "miniflare",
"testMatch": [
"**/*.test.ts"
],
"testEnvironmentOptions": {
"modules": true,
"scriptPath": "dist/worker.js",
"r2Buckets": [
"R2_BUCKET"
],
"durableObjects": {
"DURABLE_THING": "DurableThing"
}
}
}
I'm kinda new to all this; any help would be appreciated. Removing any reference to the durable object from my jest config makes non-DO tests work again.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server