You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect that skipped describe blocks don't run any code inside, and especially not assertions.
Steps to Reproduce
Create denobug.test.ts
import{describe,it}from'@std/testing/bdd';import{assertExists}from'jsr:@std/assert';letskipTestingThisVariable: string;describe.skip('skip everything in here',()=>{assertExists(skipTestingThisVariable);// <-- this line should be skippedit('should work',()=>{assertExists(true);});});
Run deno test denobug.test.ts
Uncaught error from ./denobug.test.ts FAILED
ERRORS
./denobug.test.ts (uncaught error)
error: (in promise) AssertionError: Expected actual: "undefined" to not be null or undefined.
throw new AssertionError(msg);
^
at assertExists (https://jsr.io/@std/assert/1.0.8/exists.ts:29:11)
at file:///~/deno/denobug.test.ts:7:3
at new TestSuiteInternal (https://jsr.io/@std/testing/1.0.5/_test_suite.ts:91:23)
at describe (https://jsr.io/@std/testing/1.0.5/bdd.ts:1111:22)
at Function.describeIgnore [as ignore] (https://jsr.io/@std/testing/1.0.5/bdd.ts:1176:10)
at Function.describeSkip [as skip] (https://jsr.io/@std/testing/1.0.5/bdd.ts:1208:19)
at file:///~/deno/denobug.test.ts:6:10
This error was not caught from a test and caused the test runner to fail on the referenced module.
It most likely originated from a dangling promise, event/timeout handler or top-level code.
FAILURES
./denobug.test.ts (uncaught error)
FAILED | 0 passed | 1 failed (0ms)
error: Test failed
Expected behavior
The test should be ignored. If the assertExists(skipTestingThisVariable); is moved into the it, then it's correctly ignored
import{describe,it}from'@std/testing/bdd';import{assertExists}from'jsr:@std/assert';letskipTestingThisVariable: string;describe.skip('skip everything in here',()=>{it('should work',()=>{assertExists(skipTestingThisVariable);// test is ignored nowassertExists(true);});});
Environment
deno version: 2.1.2
std version: "jsr:@std/expect@*": "1.0.8"
The text was updated successfully, but these errors were encountered:
Yeah, wording is imprecise - we will run the describe (so we can say test named a 1 is skipped), but we won't run any tests inside of it. If you have some setup that should be skipped within the describe, [p]ut it in beforeAll or beforeEach within the describe block.
Happy to take a PR specifying this in the docs 👍
I'm not advocating we keep Jest compatibility, but wondering if fixing this behavior might break something else.
@IgorM867 thanks for the clarification. Given your knowledge of Deno test internals, I wonder if you could help bring BDD style testing to VS Code? This would be a breakthrough :)
I expect that skipped
describe
blocks don't run any code inside, and especially not assertions.Steps to Reproduce
denobug.test.ts
deno test denobug.test.ts
Expected behavior
The test should be ignored. If the
assertExists(skipTestingThisVariable);
is moved into theit
, then it's correctly ignoredEnvironment
The text was updated successfully, but these errors were encountered: