Replies: 1 comment 6 replies
-
You would create a module which places the runtime code in the global scope appropriately. If you wanted the types to be available for runtime checking, you would need to declare them like: declare global {
var it: () => void;
var describe: () => void;
} You would then import it somewhere: import "./myCustomPolyfill.ts"; Which will run the global code as well as declare the global types. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Example use case:
I have to write tests for a deno app. I don't want to use the Deno API directly. Instead I want to use a custom Mocha pollyfill, which itself uses the Deno API. The file declares
globalThis.it = ...
,globalThis.describe = ....
etc.I want to be able to tell Deno to require this file and to provide the global variables/functions to every test file I have, so that I don't manually write import statements in all of my files.
How to support it?
What I envision as a support is to use the
files
key of thetsconfig
which is supplied to Deno or some special Deno only key.Motivation
This could save a lot of manual work in certain use cases.
Beta Was this translation helpful? Give feedback.
All reactions