@jrc03c/fake-jest
v0.0.21
Published
a temporary jest stand-in for esm
Readme
Introduction
This package is a temporary stand-in for Jest, which doesn't currently support ES modules (I think).
Installation
npm install --save-dev @jrc03c/fake-jestUsage
Step 1: Write a test file:
// my-cool-function.test.mjs
import { afterAll, beforeAll, expect, test } from "./index.mjs"
import { myCoolFunction } from "./my-cool-function.mjs"
beforeAll(() => {
// set up
})
afterAll(() => {
// tear down
})
test("that `myCoolFunction` works as expected", () => {
expect(() => myCoolFunction()).not.toThrow()
})Step 2a: Run the tests in my-cool-function.test.mjs by running it as a normal Node script:
node path/to/my-cool-function.test.mjs...or by invoking the fake-jest executable and passing the path as an argument:
npx fake-jest path/to/my-cool-function.test.mjsStep 2b: To run all tests in a project, invoke the fake-jest executable with no arguments:
npx fake-jest