No Description

jest.setup.js 455B

12345678910111213141516171819
  1. const { stdout } = require('stdout-stderr')
  2. const fs = require.requireActual('fs')
  3. jest.setTimeout(30000)
  4. jest.useFakeTimers()
  5. // trap console log
  6. beforeEach(() => { stdout.start() })
  7. afterEach(() => { stdout.stop() })
  8. // helper for fixtures
  9. global.fixtureFile = (output) => {
  10. return fs.readFileSync(`./test/fixture/${output}`).toString()
  11. }
  12. // helper for fixtures
  13. global.fixtureJson = (output) => {
  14. return JSON.parse(global.fixtureFile(output))
  15. }