How to run it:
- Install Jest
npm i -g jest - Save
runOrder.test.jsin a folder (ensure it is named with.test.jsas a suffix) - Run
jestin that folder
- Any code not inside of
it,beforeAll,afterAll,beforeEachorafterEachruns immediately on initialisation.- This means code at the end of your file runs before even your before hooks.
- Code inside a
describeblock runs even if the block or file has no active tests.
- Nested
beforeAllhooks run before allbeforeEachhooks regardless of the order in which they are defined. - Similarly
afterAllhooks run after allafterEachhooks.
async version of above, fwiw: https://gist.github.com/chuckplantain/8359063a1c025b5ccfce52b4f5707368