Docs: Write "Test lifecycle" page and add diagram#1806
Merged
Krinkle merged 1 commit intoqunitjs:mainfrom Apr 3, 2025
Merged
Conversation
== Test lifecycle ==
* New diagram!
* New example demonstrating module options being copied to context.
== QUnit.module § Hooks ==
* Rewrite to be more example-driven.
* Move existing examples inline, and simplify examples a lot.
Move low-level ordering details to the new "Test lifecycle" page.
For most readers these are a technically-worded distraction that
underminss the naturally correct intuition one would otherwise assume,
and wrongly give the impression that there is something unique or
complicated here.
The way QUnit works is comparable to other test frameworks, both
those that came before (e.g. PHPUnit, Python unittest), and those
that followed (e.g. Jasmine, Mocha).
Besides, most projects tend to define tests with 0 or 1 hooks,
where ordering or inheritence isn't observable. Even when a larger
ecosystem, like Ember or MediaWiki, is involved, their global hooks
and utilities work as expected without contributors needing to be
aware of where they come from. It just works!
== QUnit.module § Options ==
Promote the shorter object literal "method" syntax (ES6).
== QUnit.module § Examples ==
* "Async hook callback", moved inline.
* "Hooks on nested modules", moved to Test lifecycle page.
* "Hooks via module options", moved inline.
* "Using the test context", moved QUnit.test page, with a copy
on the Test lifecycle page as well.
* "Only run a subset of tests"
- rename to "Skip a module",
- re-arrange to lead with "QUnit.module.skip" instead of obscure
"todo" and "only".
- add new example for `QUnit.module.if()`.
Closes qunitjs#1358.
Co-authored-by: FND <fnd@localhost.localdomain>
Co-authored-by: jdittrich <d_jan@ymail.com>
Contributor
|
@Krinkle: I appreciate you following up on this! I have two minor observations:
|
Krinkle
added a commit
to Krinkle/qunit
that referenced
this pull request
Apr 3, 2025
Source on diagrams.net: https://drive.google.com/file/d/1PJ2nDZkiOreCHzH_PyQRImiH7Z0eoR8F/view?usp=sharing Export: * Export as SVG * Zoom: 100% * Border: 10 * Everythign off (Transparent, Shadow, Include diagram, Embed Fonts) Post-processing for diagrams.net bugs: * Remove any remnant `@import` for unused Google Font references. * `"Arial"` -> system-ui,sans-serif * `"monospace"` -> monospace Ref qunitjs#1806. Co-authored-by: FND <fnd@localhost.localdomain>
Member
Author
|
@FND I'm actually as surprised as you are (I prefer light mode on desktop). I didn't realize Diagrams.net produces a dark mode version by default. (https://en.wikipedia.org/wiki/Diagrams.net, https://github.com/jgraph/drawio/). Indeed, Firefox and Chrome appear to let the Safari does not support this yet. I've revised the diagram at #1807. |
Contributor
|
TIL! I'll need to look into this more closely sometime... Thanks for looking up those WebKit links! |
Krinkle
added a commit
that referenced
this pull request
Apr 3, 2025
Source on diagrams.net: https://drive.google.com/file/d/1PJ2nDZkiOreCHzH_PyQRImiH7Z0eoR8F/view?usp=sharing Export: * Export as SVG * Zoom: 100% * Border: 10 * Everythign off (Transparent, Shadow, Include diagram, Embed Fonts) Post-processing for diagrams.net bugs: * Remove any remnant `@import` for unused Google Font references. * `"Arial"` -> system-ui,sans-serif * `"monospace"` -> monospace Ref #1806. Co-authored-by: FND <fnd@localhost.localdomain>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Test lifecycle
QUnit.module § Hooks
Rewrite to be more example-driven.
Move existing examples inline, and simplify examples a lot.
Move low-level ordering details to the new "Test lifecycle" page. For most readers these are a technically-worded distraction that underminss the naturally correct intuition one would otherwise assume, and wrongly give the impression that there is something unique or complicated here.
The way QUnit works is comparable to other test frameworks, both those that came before (e.g. PHPUnit, Python unittest), and those that followed (e.g. Jasmine, Mocha).
Besides, most projects tend to define tests with 0 or 1 hooks, where ordering or inheritence isn't observable. Even when a larger ecosystem, like Ember or MediaWiki, is involved, their global hooks and utilities work as expected without contributors needing to be aware of where they come from. It just works!
QUnit.module § Options
Promote the shorter object literal "method" syntax (ES6).
QUnit.module § Examples
"Async hook callback", moved inline.
"Hooks on nested modules", moved to Test lifecycle page.
"Hooks via module options", moved inline.
"Using the test context", moved QUnit.test page, with a copy on the Test lifecycle page as well.
"Only run a subset of tests"
QUnit.module.if().