Skip to content

jest-enzyme: docs: installing jest-enzyme and its type defs #350

@espretto

Description

@espretto

Hello,
the readme currently has two split sections on installing jest-enzyme: one at the top for general import and another at the bottom for cra and ts specifics. I'd like to put them under a common headline and make the following changes:

1/ The alternative setup suggests to specify jest-enzyme's main module path. Would the following work, too?

// package.json
"jest": {
+  "setupFilesAfterEnv": ['jest-enzyme'],
-  "setupFilesAfterEnv": ['./node_modules/jest-enzyme/lib/index.js'],
}

2/ The instructions for Typescript suggest to import jest-enzyme from src/setupTests.js to ensure the signatures are available to the language-server. Alternatively, that import can be made from a .d.ts-file to be included in the tsconfig's typeRoots option. Example src/types/jest-enzyme.d.ts:

import 'jest-enzyme';

Example tsconfig.json

{
  "compilerOptions": {
    "typeRoots": ["./src/types/"]
  }
}

3/ Some links are obsolete. CRA docs on tests moved here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions