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

32 lines
558 B
TypeScript

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)
})
})
})