Closed rodhoward closed 1 month ago
I think you're running into https://github.com/oven-sh/bun/issues/5052
But I don't know if that's an error in bun/JavascriptCore or if the stubs WeakMap internally used by VTU is using some keys that aren't supposed to be used (reading https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Key_not_weakly_held).
If you're willing to take a look, you can check the key that is throwing and we'll see if that's a valid key and a bun issue or if the WeakMap is not correctly used in VTU and we should fix it.
mm I added some debugging and now I feel a little silly. I think the
import Hello from "../HelloWorld.vue";
Is just importing a file path or a string because bun doesn't have any plugin to tell it how to handle .vue files. This then causes the above error when trying to set the stubs:
stubs.set("src/components/HelloWorld.vue", "src/components/HelloWorld.vue");
Thanks for the quick response.
👍 Let's close then, thanks for looking into it.
I've been using test-utils for years! Thanks for all the hard work.
Having added lots of unit tests test performance becomes more important. I've been looking at bun as well as happy dom as a replacement for our existing unit tests in jest and jsdom.
I've followed the bun guid to set up happy dom and that seems to be working but adding test utils into the mix isn't working. I'm getting the following error:
And my unit test looks like this:
I suspect this fix might need to come from bun.. but I'm hoping you might know better what exactly is the issue and can report it more accurately to them than I can. There might even be a feature request or bug in bun that relates to this issue that I could monitor?
Regards Rod