# @lg-tools/test

> Jest setup & config for LeafyGreen repositories

Latest version **0.5.2** (published 2026-10-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @lg-tools/test
pnpm add @lg-tools/test
yarn add @lg-tools/test
bun add @lg-tools/test
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2026-10-02 |
| First published | 2023-07-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 27 |
| Unpacked size | 61.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 274 |
| Maintainers | shaneeza, thesonofthomp, aitchpgm, _tsck, stephl3 |

## Links

- npm: https://www.npmjs.com/package/@lg-tools/test
- Repository: https://github.com/mongodb/leafygreen-ui
- Homepage: https://github.com/mongodb/leafygreen-ui#readme
- Issues: https://github.com/mongodb/leafygreen-ui/issues
- npm.io page: https://npm.io/package/@lg-tools/test

## Dependencies (27)

- [jest](https://npm.io/package/jest.md) 29.6.2
- [chalk](https://npm.io/package/chalk.md) 4.1.2
- [fs-extra](https://npm.io/package/fs-extra.md) 11.1.1
- [jest-axe](https://npm.io/package/jest-axe.md) 8.0.0
- [babel-jest](https://npm.io/package/babel-jest.md) 29.7.0
- [jest-junit](https://npm.io/package/jest-junit.md) 16.0.0
- [@types/jest](https://npm.io/package/@types/jest.md) 29.5.12
- [cross-spawn](https://npm.io/package/cross-spawn.md) 7.0.3
- [@emotion/css](https://npm.io/package/@emotion/css.md) 11.9.0
- [@emotion/cache](https://npm.io/package/@emotion/cache.md) 11.11.0
- [@emotion/react](https://npm.io/package/@emotion/react.md) 11.11.1
- [@lg-tools/meta](https://npm.io/package/@lg-tools/meta.md) ^0.6.4
- [@emotion/server](https://npm.io/package/@emotion/server.md) 11.11.0
- [@lg-tools/build](https://npm.io/package/@lg-tools/build.md) ^0.9.2
- [@types/fs-extra](https://npm.io/package/@types/fs-extra.md) 11.0.1
- [@types/jest-axe](https://npm.io/package/@types/jest-axe.md) 3.5.5
- [jest-canvas-mock](https://npm.io/package/jest-canvas-mock.md) 2.5.1
- [@types/cross-spawn](https://npm.io/package/@types/cross-spawn.md) 6.0.2
- [react-test-renderer](https://npm.io/package/react-test-renderer.md) 18.2.0
- [regenerator-runtime](https://npm.io/package/regenerator-runtime.md) 0.14.0
- [@testing-library/dom](https://npm.io/package/@testing-library/dom.md) 9.3.1
- [@testing-library/react](https://npm.io/package/@testing-library/react.md) 14.0.0
- [jest-environment-jsdom](https://npm.io/package/jest-environment-jsdom.md) 29.6.2
- [@testing-library/jest-dom](https://npm.io/package/@testing-library/jest-dom.md) 5.17.0
- [@leafygreen-ui/testing-lib](https://npm.io/package/@leafygreen-ui/testing-lib.md) ^0.9.2
- [@testing-library/user-event](https://npm.io/package/@testing-library/user-event.md) 13.5.0
- [@testing-library/react-hooks](https://npm.io/package/@testing-library/react-hooks.md) 8.0.1

## Recent versions

- 0.5.2 (latest) — 2026-10-02
- 0.1.0 (beta) — 2023-07-26
- 0.1.0-alpha.0 (alpha) — 2023-07-18
- 0.5.1 — 2025-12-17
- 0.5.0 — 2025-09-30
- 0.4.20 — 2025-09-25
- 0.4.19 — 2025-05-29
- 0.4.18 — 2025-04-28
- 0.4.17 — 2025-04-22
- 0.4.16 — 2025-04-08
- 0.4.15 — 2025-03-03
- 0.4.14 — 2025-02-06
- 0.4.13 — 2025-01-21
- 0.4.12 — 2025-01-18
- 0.4.11 — 2025-01-09
- … 17 more at https://npm.io/package/@lg-tools/test/versions

## README

# `@lg-tools/test`

Shared test config & scripts for LeafyGreen repositories.

## Usage

It's best not to use this as a standalone package, but use it as part of `@lg-tools/cli` instead.

To run tests using the shared config, use the `lg` cli:

```bash
> lg test
```

### Options

To see all options for this command run:

```bash
> lg test --help
```

### Extending & overriding the shared config

To extend/override the shared config (located in `@lg-tools/test/config`), create a `jest.config.js` file at the root of the repository, and extend the default config with the code below:

```js
// ./jest.config.js
const jestConfig = require('@lg-tools/test/config/js.config.js');

module.exports = {
  ...jestConfig,
  // extend your jest config here
};
```

You can also pass a `--config` option to the test command:

```bash
> lg test --config ./path/to/config
```

### Testing in React 17

In CI we test our components using React 17.

To do this manually, first run the [init script](./scripts/install-react17.ts) in order to install the specific testing dependencies needed for React 17. (`yarn init17` from the repo root)

```bash
> yarn init17
```

Next, run your tests with the `--react17` flag. This ensures that the tests are run with specific Jest config for React 17.

```bash
> yarn test --react17
```

To go back to the default version of React you'll need to clear your packages and re-build:

```
> yarn clean:modules && yarn run init
```

---
_Source: https://npm.io/package/@lg-tools/test · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
