Skip to content

Document event life cycle #1797

Open
Open
@Krinkle

Description

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]

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions