Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 8a4832a

Browse files
committed
(docs): add initial README
- with all my regular badges - with most of my classic sections (Installation, Usage, Examples, How it Works, and Credits) - pretty simple as it's just Jest, but you import the globals o.o
1 parent 890daba commit 8a4832a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# jest-without-globals
2+
3+
<!-- releases / versioning -->
4+
[![package-json](https://img.shields.io/github/package-json/v/agilgur5/jest-without-globals.svg)](https://npmjs.org/package/jest-without-globals)
5+
[![releases](https://img.shields.io/github/tag-pre/agilgur5/jest-without-globals.svg)](https://github.com/agilgur5/jest-without-globals/releases)
6+
[![commits](https://img.shields.io/github/commits-since/agilgur5/jest-without-globals/latest?sort=semver&include_prereleases.svg)](https://github.com/agilgur5/jest-without-globals/commits/master)
7+
<br><!-- downloads -->
8+
[![dt](https://img.shields.io/npm/dt/jest-without-globals.svg)](https://npmjs.org/package/jest-without-globals)
9+
[![dy](https://img.shields.io/npm/dy/jest-without-globals.svg)](https://npmjs.org/package/jest-without-globals)
10+
[![dm](https://img.shields.io/npm/dm/jest-without-globals.svg)](https://npmjs.org/package/jest-without-globals)
11+
[![dw](https://img.shields.io/npm/dw/jest-without-globals.svg)](https://npmjs.org/package/jest-without-globals)
12+
<br><!-- status / activity -->
13+
[![typings](https://img.shields.io/npm/types/jest-without-globals.svg)](https://github.com/agilgur5/jest-without-globals/blob/master/src/index.ts)
14+
[![build status](https://img.shields.io/travis/agilgur5/jest-without-globals/master.svg)](https://travis-ci.org/agilgur5/jest-without-globals)
15+
[![code coverage](https://img.shields.io/codecov/c/gh/agilgur5/jest-without-globals/master.svg)](https://codecov.io/gh/agilgur5/jest-without-globals)
16+
<br>
17+
[![NPM](https://nodei.co/npm/jest-without-globals.png?downloads=true&downloadRank=true&stars=true)](https://npmjs.org/package/jest-without-globals)
18+
19+
Explicitly import [Jest](https://github.com/facebook/jest) globals.
20+
21+
## Installation
22+
23+
`npm i -D jest-without-globals`
24+
25+
## Usage
26+
27+
```typescript
28+
import { describe, it, expect } from 'jest-without-globals'
29+
30+
describe('describe should create a section', () => {
31+
it('it should checkmark', () => {
32+
expect('').toBe('')
33+
})
34+
})
35+
```
36+
37+
All of the functions available in [Jest's API](https://jestjs.io/docs/en/api), as well as `jest` and `expect`, can be imported from `jest-without-globals`.
38+
39+
## Examples
40+
41+
Can take a look at the [tests](./test/) for usage of more of the globals, but basically you can now just `import` any Jest global.
42+
43+
## How it works
44+
45+
Basically just takes Jest's globals and exports them.
46+
The source code is currently shorter than this README, so [take a look under the hood](./src/)! :)
47+
48+
## Credits
49+
50+
Some inspiration for this came from [this workaround](https://github.com/facebook/jest/pull/7571#issuecomment-498634094) to avoid globals, which I had been using in projects previously.
51+
I wanted a package I could re-use in all my projects' tests instead of constantly having to create a helper file and map its name, and so `jest-without-globals` was born.

0 commit comments

Comments
 (0)