diff --git a/packages/parity/jest.config.cjs b/packages/parity/jest.config.cjs index de861ab8..70481025 100644 --- a/packages/parity/jest.config.cjs +++ b/packages/parity/jest.config.cjs @@ -1,3 +1,10 @@ +const mappedModule = process.env.TEST_ENV === 'prod' ? '/dist/$1' : '/src/$1'; + module.exports = { preset: 'jest-config', + testMatch: ['/src/**?(*.)+(spec|test).+(ts|tsx)'], + moduleNameMapper: { + '^@/(.*)\\.js$': mappedModule, + }, + testEnvironment: 'jsdom', }; diff --git a/packages/parity/package.json b/packages/parity/package.json index bee8ee96..62802c38 100644 --- a/packages/parity/package.json +++ b/packages/parity/package.json @@ -1,14 +1,13 @@ { "name": "@waldronmatt/parity", "version": "1.0.5", - "main": "./dist/index.cjs", + "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", "type": "module", "exports": { ".": { "types": "./dist/index.d.ts", - "require": "./dist/index.cjs", "import": "./dist/index.js" }, "./*": "./dist/*" @@ -25,7 +24,7 @@ "test:watch": "jest --watch", "test:prod": "cross-env TEST_ENV=prod NODE_OPTIONS=--experimental-vm-modules jest", "build:dtsmaps": "tsc --project tsconfig.build.json", - "build:src": "tsup src/*[!.spec].ts --format cjs,esm --sourcemap --onSuccess \"pnpm build:dtsmaps\"", + "build:src": "tsup src/*[!.spec].ts --format esm --sourcemap --onSuccess \"pnpm build:dtsmaps\"", "clean": "rimraf dist coverage tsconfig.build.tsbuildinfo", "build": "pnpm build:src", "stub": "npx unbuild --stub"