Skip to content

Instantly share code, notes, and snippets.

View LukeSamkharadze's full-sized avatar
💻
Coding

Luka Samkharadze LukeSamkharadze

💻
Coding
View GitHub Profile
@tamlyn
tamlyn / README.md
Last active July 7, 2022 09:48
Execution order of Jest/Jasmine test code

Execution order of Jest/Jasmine test code

While tests run in source order, surrounding code does not which can lead to hard to debug issues.

Compare the test file below with the sample output below that and note the order of the log messages.

Key points

  • Any code not inside of it, beforeAll, afterAll, beforeEach or afterEach runs immediately on initialisation.
  • This means code at the end of your file runs before even your before hooks.