-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add global test registry #568
Conversation
@ry do you want me to change anything else in this PR? |
@@ -69,8 +69,29 @@ function print(txt: string, newline: boolean = true): void { | |||
Deno.stdout.writeSync(encoder.encode(`${txt}`)); | |||
} | |||
|
|||
declare global { | |||
interface Window { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really necessary to declare this before hand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it TS complains that __DENO_TEST_REGISTRY
doesn't exist on Window
:
error TS2339: Property '__DENO_TEST_REGISTRY' does not exist on type 'Window'.
► file:///Users/biwanczuk/dev/deno_std/testing/mod.ts:90:23
90 candidates = window.__DENO_TEST_REGISTRY as TestDefinition[];
I can add @ts-ignore
but this solution is more idiomatic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
After adding deno test command a new problem appeared. If you try running deno test inside this repo test runner will find 80 test files but won't run any tests! This is caused by fact that deno test uses tagged version of standard library which causes test function available inside to repo to be different function that test available in standard lib used by deno test. Original: denoland/std@4531fa8
After adding
deno test
command a new problem appeared.If you try running
deno test
inside this repo test runner will find 80 test files but won't run any tests! This is caused by fact thatdeno test
uses tagged version of standard library which causestest
function available inside to repo to be different function thattest
available in standard lib used bydeno test
.A simple fix appears to be to add a global registry of all tests. It causes to register every test (even using
test
function from different version of standard lib) in the same global array that can be picked up by test runner.That's just first iteration and we'll probably arrive at better solution before landing this PR.
CC @ry