This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
works-on-my-machine/tests/hooks.test.ts

33 lines
558 B
TypeScript
Raw Permalink Normal View History

import assert from 'assert'
import { test, describe, beforeEach, afterEach, expect } from 'works-on-my-machine'
describe('Test group lifecycle hooks', () => {
let outer: boolean = false
beforeEach(() => {
outer = true
})
afterEach(() => {
outer = false
})
describe('beforeEach', () => {
let inner: boolean = false
beforeEach(() => {
inner = true
})
afterEach(() => {
inner = false
})
test('all beforeEach side-effects run before each test runs', () => {
expect(inner).toBe(true)
expect(outer).toBe(true)
})
})
})