-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat(cli/js/testing): Add TestDefinition::skip #4351
Conversation
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.
@nayeemrmn looks ok, but I'm a bit hesitant to change Deno.test()
signature right now
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.
enum TestStatus { | ||
Passed = "passed", | ||
Failed = "failed", | ||
Skipped = "skipped" | ||
} |
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.
We should probably collapse all of little interfaces and enums for testing under a single namespace...
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.
Just realised these are all implicitly public via TestReporter
in RunTestsOptions
so that would be necessary. The TestEvent*
stuff can and should be hidden IMO with some restructuring. All that needs to be public is TestReporter
, TestResult
, TestStatus
and TestStats
each with no references to any other proprietary type.
EDIT: Actually TestEvent{Start,Result,End}
are necessary to keep TestReporter
simple and extensible, but not TestEvent
.
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.
How is this?
namespace tests {
export interface Result {
name: string;
status: "passed" | "failed" | "skipped";
duration?: number;
error?: Error;
}
export interface Stats {
filtered: number;
ignored: number;
measured: number;
passed: number;
failed: number;
}
export interface StartEvent {
tests: Deno.TestDefinition[];
}
export interface ResultEvent {
result: Result;
}
export interface EndEvent {
stats: Stats;
duration: number;
results: Result[];
}
export interface Reporter {
start(msg: StartEvent): Promise<void>;
result(msg: ResultEvent): Promise<void>;
end(msg: EndEvent): Promise<void>;
}
export class ConsoleReporter implements Reporter {
// ...
}
}
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.
@nayeemrmn I already needed to split "result" into two separate messages for #4371
We should figure this out before 1.0, but it's not actionable for this PR
@nayeemrmn can you roll back changes to |
e531caa
to
92a3c09
Compare
I'm fine with exposing "skip" but this PR conflicts with #4371. @bartlomieju - leaving this to you to figure out how to merge and in which order. |
With realising that @nayeemrmn was already working on this, I also went to tackle adding I'll not take my changes any further as this PR seems to cover it. |
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, thanks @nayeemrmn!
Closes #4098.
OUTDATED EXAMPLE: shorthands no longer support
skip
.test.ts
:cargo run -- test test.ts
:cc @bartlomieju