Skip to content

Commit

Permalink
fixup! Refactor(repo): Introduce a common Jest config preset
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed May 15, 2024
1 parent 3e47446 commit c82c013
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions configs/jest-config-spirit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@

This preset is part of this monorepo only and thus it is accessible for every package.

To install `jest-config-carbon` in your project, you will need to run the following command using [Yarn](https://yarnpkg.com/en/):

```bash
yarn add jest-config-spirit
```

## ⚙️ Configurations

### `jest-preset-spirit/node`

The default Jest configuration for Node.js projects.

### `jest-preset-spirit/jsdom`

The extension of the default preset for projects that require a browser-like (DOM) environment.

## 🚀 Usage

```js
// jest.config.js

const config = {
preset: 'jest-config-spirit/jsdom',
};

export default config;
```

## 🙌 Contributing

We're always looking for contributors to help us fix bugs, build new features,
Expand Down
1 change: 1 addition & 0 deletions configs/jest-config-spirit/jest-preset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line import/extensions
import { config } from './node/index.js';

export default config;
1 change: 1 addition & 0 deletions configs/jest-config-spirit/jsdom/setup/setupAfterEnv.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import '@testing-library/jest-dom';
// eslint-disable-next-line import/no-extraneous-dependencies
import ResizeObserverPolyfill from 'resize-observer-polyfill';

global.ResizeObserver = ResizeObserverPolyfill;
Expand Down

0 comments on commit c82c013

Please sign in to comment.