New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jest-without-globals

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-without-globals

Explicitly import Jest globals

0.0.3
latest
Source
npm
Version published
Weekly downloads
1.3K
9.26%
Maintainers
1
Weekly downloads
 
Created
Source

jest-without-globals

package-json releases commits
dt dy dm dw
typings build status code coverage
NPM

Explicitly import Jest globals.

Installation

npm i -D jest-without-globals

(note that jest is a peer dependency)

Usage

import { describe, it, expect } from 'jest-without-globals'

describe('describe should create a section', () => {
  it('it should checkmark', () => {
    expect('').toBe('')
  })
})

All of the functions available in Jest's API, as well as jest and expect, can be imported from jest-without-globals.

Examples

Can take a look at the tests for usage of more of the globals, but basically you can now just import any Jest global.

How it works

Basically just takes Jest's globals and exports them. The source code is currently shorter than this README, so take a look under the hood! :)

Credits

Some inspiration came from this workaround to avoid globals, which I had been using in projects previously. 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!

Keywords

jest

FAQs

Package last updated on 15 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts