Skip to content

docs: document conditional test-suite abort in BDD tutorial#3115

Open
lunadogbot wants to merge 4 commits into
mainfrom
orch/issue-59
Open

docs: document conditional test-suite abort in BDD tutorial#3115
lunadogbot wants to merge 4 commits into
mainfrom
orch/issue-59

Conversation

@lunadogbot
Copy link
Copy Markdown
Contributor

Summary

The BDD tutorial covers beforeAll/afterAll for setting up a database
connection but doesn't address what happens when that connection (or
another precondition) fails before the suite runs. A reader flagged this
gap via the docs feedback widget on the BDD tutorial page:

Describe how to abort a test suite if a condition isn't met (e.g.
database connectivity)

This PR adds a short sub-section right after beforeAll/afterAll
covering two patterns:

  • Throw from beforeAll — fails the suite loudly so CI surfaces
    the missing precondition as a real error.
  • Skip with the ignore option on describe / it — compute a
    boolean once at the top of the file (e.g. const dbReachable = await isDatabaseReachable()) and pass { ignore: !dbReachable } to the
    describe block, so the suite is reported as ignored instead of
    failed when the precondition is expected to be unmet locally.

The example uses the same Database.connect(TEST_CONNECTION_STRING)
shape as the existing beforeAll/afterAll example for consistency.

Test plan

  • deno fmt passes on examples/tutorials/bdd.md.
  • API verified against @std/testing/bdd (v1.0.18) — the
    describe(name, { ignore }, fn) and it(name, { ignore }, fn)
    overloads exist and ignore is forwarded to Deno.TestDefinition.
  • Reviewer to spot-check the rendered page locally if possible.

Upstream: #2984
Closes bartlomieju/orchid-inbox#59

Adds a section after beforeAll/afterAll covering two patterns for
aborting a test suite when a precondition (e.g. database connectivity)
isn't met: throwing from beforeAll, and using the `ignore` option on
describe/it.

Closes #2984
Copy link
Copy Markdown
Contributor

@fibibot fibibot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API claim checks out — DescribeDefinition/ItDefinition extend Omit<Deno.TestDefinition, "fn"> in @std/testing/bdd (v1.0.18), so ignore?: boolean is inherited and the (name, { ignore }, fn) overload is real. The two patterns (throw-from-beforeAll for hard failures, ignore for expected-missing preconditions) are the right framing — Deno.test's own docs make the same distinction.

lint and link check is still in progress; holding approval until it lands green.

  • nit: last_modified: 2026-02-03 not bumped — 72-line content addition is substantive.
  • nit: #3111 also rewrites this file's beforeAll/afterAll example. The new section here is inserted right after that example, so merge order matters. Worth coordinating with @bartlomieju.

@lunadogbot
Copy link
Copy Markdown
Contributor Author

Thanks for the review! Addressed nit 1: bumped last_modified to 2026-05-14 in babb98a.

On nit 2 (#3111 overlap): the new sub-section here only inserts after the existing beforeAll/afterAll example — it doesn't touch the example itself. As written, this PR is internally consistent against current main. If #3111 lands first, this branch will need a trivial rebase to slot the new sub-section after the rewritten HTTP-service example (the framing — "throw to fail loud, ignore to skip cleanly" — stands regardless of which example precedes it). Happy to wait on #3111 and rebase, or land first and let the other PR rebase, whichever @bartlomieju prefers.

@lunadogbot
Copy link
Copy Markdown
Contributor Author

The lint and link check failure is unrelated to this PR — the Lume MDX engine is choking on /styleguide/typography.mdx (Cannot resolve module "lume/jsx-runtime"), and the same failure reproduces on every other open PR (#3117, #3118, #3119). Deploy preview build is the same site build path and is unaffected.

Nothing to fix on this branch.

Copy link
Copy Markdown
Contributor

@fibibot fibibot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed: the lint failure reproduces on #3117/#3118/#3119 with the same Cannot resolve module "lume/jsx-runtime" against /styleguide/typography.mdx — MDX-engine/config issue, not this PR. deploy/deno/docs (the actual site build) is green.

last_modified bump landed. Holding at COMMENT — repo rules require green CI for APPROVE. Will flip when the lint pipeline clears.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants