Skip to content

Instantly share code, notes, and snippets.

@aaemnnosttv
Created May 26, 2020 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaemnnosttv/9a177ef4da4ccf7ac23997643ccd3cbf to your computer and use it in GitHub Desktop.
Save aaemnnosttv/9a177ef4da4ccf7ac23997643ccd3cbf to your computer and use it in GitHub Desktop.
Jest order of operations
describe( 'level 0', () => {
beforeAll( () => console.log( 'beforeAll', 'Level 0' ) );
afterAll( () => console.log( 'afterAll', 'Level 0' ) );
beforeEach( () => console.log( 'beforeEach', 'Level 0' ) );
afterEach( () => console.log( 'afterEach', 'Level 0' ) );
describe( 'level 1A', () => {
beforeAll( () => console.log( 'beforeAll', 'Level 1A' ) );
afterAll( () => console.log( 'afterAll', 'Level 1A' ) );
beforeEach( () => console.log( 'beforeEach', 'Level 1A' ) );
afterEach( () => console.log( 'afterEach', 'Level 1A' ) );
it( 'level 1A test 1', () => console.log( 'level 1A test 1' ) );
it( 'level 1A test 2', () => console.log( 'level 1A test 2' ) );
} );
describe.only( 'level 1B', () => {
beforeAll( () => console.log( 'beforeAll', 'Level 1B' ) );
afterAll( () => console.log( 'afterAll', 'Level 1B' ) );
beforeEach( () => console.log( 'beforeEach', 'Level 1B' ) );
afterEach( () => console.log( 'afterEach', 'Level 1B' ) );
it( 'level 1B test 1', () => console.log( 'level 1B test 1' ) );
it( 'level 1B test 2', () => console.log( 'level 1B test 2' ) );
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment