Imports a package and runs the code using different module strategies.
yarn start
or by tasks
yarn compile
yarn jest
yarn ts
or by individual strategies:
compile:cjs
compile:esm
compile:ts:nodenext
compile:ts:ts-node
compile:ts:tsx
jest:cjs
jest:esm
jest:ts
ts:commonjs
ts:nodenext
- imports using
require
(commonjs) - imports using
import
(esm)
- checks types with
moduleResolution: commonjs
- checks types with
moduleResolution: nodenext
- tests a commonjs module (native behavior)
- tests a esm module (following instructions from docs)
- tests a ts module (with ts-jest)
- Install package
yarn install @my/package-to-test
- Edit source files with imports/requires to package and a dummy call to it:
src/cjs/index.cjs
src/esm/index.mjs
src/ts/index.ts
- Run tests suite
yarn start