-
I'd like to set up an assertion library on the global window scope so that I can polyfill a few things in one place and have them available everywhere (essentially jestjs/jest#11065 (comment), but I don't want to import buffer and expect in each of my tests, if possible). In normal node mocha tests, I'd set up a I've tried adding my setup as the first file in my list of files to test, but it seems that the global scope is not shared with other tests. This is nice, in terms of sandboxing, but I was really hoping for a nice method to inject this. I've also tried using the Can anyone think of a good way to accomplish this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think I've figured this out, actually. I've added a file called
and
Which seems to put my modified |
Beta Was this translation helpful? Give feedback.
I think I've figured this out, actually. I've added a file called
src/test-setup/expect.ts
. It has to be in one of the mounted directories, that tripped me up a bit at first. Then, I can usetestRunnerHtml
and point to/dist/test-setup/expect.js
, which is the name of the file after snowpack transforms it. So, I end up with something like:and