@lifeomic/jest-config
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

jest-config

Shared Jest config utils etc.

preset

Publish a preset file for jest. Jest 29

{
  "preset": "@lifeomic/jest-config"
}

Config was extracted from lifeomic/typescript-tools

expect enhancement

Matchers can be exposed at the root level. The library needs to be imported at some level to work.

Jest-extended setup instructions

{
  "setupFiles": ["@lifeomic/jest-config"]
}

OR

{
  "setupFilesAfterEnv": ["@lifeomic/jest-config"]
}

The project can also be imported inside internal setup/test files using a setup file. setup.ts

import ('@lifeomic/jest-config');

To get typescript to see the types, it has been necessary to include something in the tsconfig.json.

{
  "include": [
    "setup.ts"
  ]
}

After importing, all matchers are now exposed at the root level, and can be not-ed.

test('has exposed some desired methods', () => {
  expect({
    numberVal: .31,
    otherNum: .3,
  }).toEqual({
    numberVal: expect.toBeCloseTo(0.3, 1),
    otherNum: expect.not.toBeCloseTo(0.2),
  });
});

Readme

Keywords

none

Package Sidebar

Install

npm i @lifeomic/jest-config

Weekly Downloads

126

Version

2.0.0

License

MIT

Unpacked Size

6.21 kB

Total Files

5

Last publish

Collaborators

  • lifeomicdev
  • npm-lifeomicdev-github