https://github.com/live-codes/browser-jest
Run Jest in the browser
https://github.com/live-codes/browser-jest
Last synced: 12 months ago
JSON representation
Run Jest in the browser
- Host: GitHub
- URL: https://github.com/live-codes/browser-jest
- Owner: live-codes
- License: mit
- Created: 2023-09-14T16:58:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-16T21:17:00.000Z (almost 3 years ago)
- Last Synced: 2025-06-08T04:42:41.323Z (about 1 year ago)
- Language: JavaScript
- Size: 1.08 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: FUNDING.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Jest in Browser
This project aims to make Jest work in the browser. As used in [LiveCodes](https://github.com/live-codes/livecodes).
## Usage
ESM:
```js
import {
afterAll,
afterEach,
beforeAll,
beforeEach,
describe,
fdescribe,
xdescribe,
it,
test,
fit,
xtest,
xit,
expect,
jest,
run,
} from 'https://unpkg.com/@live-codes/browser-jest';
test.each([
[1, 1, 2],
[1, 2, 3],
[2, 1, 3],
])('.add(%i, %i)', (a, b, expected) => {
expect(a + b).toBe(expected);
});
test('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
run().then((results) => {
console.log(results);
});
```
UMD:
```html
const {
afterAll,
afterEach,
beforeAll,
beforeEach,
describe,
fdescribe,
xdescribe,
it,
test,
fit,
xtest,
xit,
expect,
jest,
run,
} = window.browserJest;
```