Skip to content
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

Document event life cycle #1797

Open
Krinkle opened this issue Aug 18, 2024 · 1 comment
Open

Document event life cycle #1797

Krinkle opened this issue Aug 18, 2024 · 1 comment
Labels
Category: Docs Type: Meta Seek input from maintainers and contributors.

Comments

@Krinkle
Copy link
Member

Krinkle commented Aug 18, 2024

We have:

While each is well-documented, and describes when it runs, and how (sync or async), we don't have yet provided an explicit overview of the overall order of events. Where this matters most is:

  • between QUnit.begin() and QUnit.on('runStart') which logically run at the same time. Idem for QUnit.done() and QUnit.on('runEnd'). Consider a sentence like "QUnit.config.urlConfig modifications must be made before QUnit.begin". Does that mean runStart is fine, or is that too late? And is that supported or accidental?
  • between hooks.afterEach and QUnit.testDone(), where the order is not obvious per se, ref New test reporter hook #1475.

Life cycle

I wrote up the following to get us started.

Would a table be clearer?

Event Purpose Note
QUnit.on('runStart') ✏️ reporter event [sync]
QUnit.begin() ⚙️ plugin callback [async-await]
📦 QUnit.on('suiteStart') ✏️ reporter event [sync] For each module
📦 QUnit.moduleStart() ⚙️ plugin callback [async-await] For each module
QUnit.on('testStart') ✏️ reporter event [sync] For each test
QUnit.testStart() ⚙️ plugin callback [async-await] For each test
hooks.before() testing [async-await] Before first test in a module
global QUnit.hooks.beforeEach() ⚙️ plugin [async-await] For each test
hooks.beforeEach() testing [async-await] For each test
QUnit.test() function testing [async-await] For each test
QUnit.log() ⚙️ plugin callback [sync] For each assertion
hooks.afterEach() testing [async-await] For each test
global QUnit.hooks.afterEach() ⚙️ plugin [async-await] For each test
hooks.after() testing [async-await] After last test in a module
QUnit.on('testEnd') ✏️ reporter event [sync] For each test
QUnit.testDone() ⚙️ plugin callback [async-await] For each test
📦 QUnit.on('suiteEnd') ✏️ reporter event [sync] For each module
📦 QUnit.moduleDone() ⚙️ plugin callback [async-await] For each module
QUnit.on('runEnd') ✏️ reporter event [sync]
QUnit.done() ⚙️ plugin callback [async-await]
@Krinkle Krinkle added Type: Meta Seek input from maintainers and contributors. Category: Docs labels Aug 18, 2024
@Krinkle
Copy link
Member Author

Krinkle commented Aug 18, 2024

Inspired by #1328 (@raycohen), where afaik we did not change this order so this page could be version agnostic I think? (e.g. applicable to both QUnit 2 and 3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Docs Type: Meta Seek input from maintainers and contributors.
Development

No branches or pull requests

1 participant