jest-next-dynamic-ts
v0.1.1
Published
Jest & Next.js - Dynamic import with TypeScript
Downloads
12,210
Maintainers
Readme
jest-next-dynamic-ts
Inspired by jest-next-dynamic.
Added TypeScript based on jest-next-dynamic.
GitHub: jest-next-dynamic-ts
npm: jest-next-dynamic-ts
📚 Install dependencies
npm install -D jest-next-dynamic-ts
🧪 Usage
// This will mock `next/dynamic`, so make sure to import it before any of your
// components.
import preloadAll from "jest-next-dynamic-ts";
// This component can have dynamic imports anywhere in its rendered tree,
// including nested dynamic imports.
import SomeComponent from "./SomeComponent";
beforeAll(async () => {
await preloadAll();
});
// Your tests here!