Skip to content

Commit

Permalink
build: set package exports and use c8 to get coverage for ssr tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdyman committed Aug 26, 2023
1 parent 11bc94d commit 6cc66ed
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 103 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ jobs:
- name: 🔨 Build
run: pnpm run build

- name: 🧑‍🏫 Build Example Project
run: pnpm run --filter @this/example build

- name: 🕵️ Check Package Configuration
run: pnpm run check:package

- name: 🧪 Test
run: |
pnpm dlx playwright install chromium
pnpm run --filter @this/example build
pnpm run test:ci
- name: 🛫 Upload Test Coverage
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.DS_Store
node_modules
.cache
*.tgz
dist
coverage
*.ignore
Expand Down
20 changes: 14 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
"sideEffects": false,
"module": "dist/index.mjs",
"types": "dist/index.d.mts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.mts"
}
},
"files": [
"dist"
],
Expand All @@ -42,11 +49,11 @@
"start": "concurrently -k -s first -n \"tsup,ts\" -c \"blue,cyan\" \"pnpm run dev\" \"pnpm run check:types --watch\"",
"build": "pnpm run check:types && NODE_ENV=production tsup",
"release": "pnpm run build && np --no-2fa",
"test": "pnpm --filter @this/ssr-tests run test && pnpm --filter @this/storybook run test",
"test:coverage": "pnpm --filter @this/ssr-tests run test && pnpm run test:storybook",
"test:ci": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"pnpm run --filter @this/storybook storybook:build --quiet && pnpm sirv ./docs/storybook/storybook-static --host 127.0.0.1 --port 6006\" \"pnpm wait-port 6006 && pnpm run test:coverage\"",
"test:storybook": "pnpm run test --coverage && pnpm nyc report --reporter=lcov -t ./docs/storybook/coverage/storybook --report-dir ./coverage/storybook",
"check:package": "pkg-ok",
"test": "rm -rf coverage && concurrently -n \"ssr,sb\" -c \"magenta,blue\" \"pnpm run test:ssr\" \"pnpm run test:storybook\"",
"test:ci": "concurrently -k -s first -n \"sb,test\" -c \"magenta,blue\" \"pnpm run --filter @this/storybook storybook:build --quiet && pnpm sirv ./docs/storybook/storybook-static --host 127.0.0.1 --port 6006\" \"pnpm wait-port 6006 && pnpm run test\"",
"test:ssr": "pnpm c8 -o ./coverage/ssr-tests -r text -r lcov node --test ./docs/ssr-tests/ssr.test.mjs",
"test:storybook": "pnpm --filter @this/storybook run test --coverage && pnpm nyc report --reporter=lcov -t ./docs/storybook/coverage/storybook --report-dir ./coverage/storybook",
"check:package": "attw -P . --ignore-rules cjs-resolves-to-esm",
"check:types": "tsc --noEmit",
"lint": "concurrently -n \"eslint,prettier\" -c \"green,magenta\" \"pnpm run lint:eslint\" \"pnpm run lint:prettier\"",
"lint:eslint": "eslint .",
Expand Down Expand Up @@ -90,6 +97,7 @@
"react-dom": ">=16.8"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.8.0",
"@ianvs/prettier-plugin-sort-imports": "^3.7.2",
"@types/node": "^20.5.6",
"@types/react": "^18.2.21",
Expand All @@ -98,6 +106,7 @@
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"browserslist": "^4.21.10",
"c8": "^8.0.1",
"concurrently": "^8.2.1",
"esbuild-plugin-browserslist": "^0.9.0",
"eslint": "^8.48.0",
Expand All @@ -107,7 +116,6 @@
"lint-staged": "^13.2.3",
"np": "^8.0.4",
"nyc": "^15.1.0",
"pkg-ok": "^3.0.0",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.3",
"react": "^18.2.0",
Expand Down

0 comments on commit 6cc66ed

Please sign in to comment.