-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Add TestDefinition::skip #4098
Comments
i like this. |
|
@sholladay This is not compatible with current syntax. The proposal don't disrupt current api. See test documentation. |
I could open a separate issue, I suppose. It's directly related, though. People who don't use the object-based syntax (like me) don't want to have to start using it just to skip a test. It needs to support the shorthand form. |
If we want to apply this to the shorthand (which we currently have two of unfortunately), we can give it an options object containing the missing fields from export function test(t: TestDefinition): void;
export function test(fn: TestFunction, options?: Omit<TestDefinition, "name" | "fn">): void;
// ... |
Why not use the API of an existing popular testing library like AVA? Not only does that make things more familiar to users, but AVA already has high quality TypeScript type definitions that can be reused, which makes Deno development and maintenance easier. It's also a superior API in my opinion. test.skip(name, fn); |
I'm ok with |
The only problem with that, is that it makes it harder to do a conditional skip. For example, you might want to skip on a particular OS for a time period: Deno.test({
skip: Deno.build.os === "win",
name: "skip on windows",
fn() { /* ... */ }
} It is also easier to comment out or remove... |
I mean, you could use a simple ternary to do the same thing with function shorthand. I already destructure const testNix = Deno.build.os === 'win' ? Deno.test.skip : Deno.test;
testNix('skip on windows', () => { /* ... */ }); There are other possibilities here, too. With AVA, one can write a test macro to conditionally pass/fail any tests that use it. They are also planning to implement Deno.test('skip on windows', (t) => {
if (Deno.build.os === 'win') {
t.cancel();
}
}); |
I said harder, not impossible. |
Allow the following to disable a test:
Then uncomment all disabled tests in
cli/js
andstd
and skip them like this. That way the APIs used in disabled tests will forcibly be kept up to date (most of the time). Seen in #4092.cc @bartlomieju
The text was updated successfully, but these errors were encountered: