@thepalaceproject/circulation-admin 1.43.0-post.1 → 1.43.0-post.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nycrc.json +8 -0
- package/CLAUDE.md +7 -0
- package/eslint.config.mjs +9 -1
- package/jest.config.js +15 -0
- package/package.json +6 -2
package/.nycrc.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/nycrc",
|
|
3
|
+
"extension": [".ts", ".tsx"],
|
|
4
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
5
|
+
"exclude": ["src/**/__tests__/**", "src/testHelper.ts", "**/*.d.ts"],
|
|
6
|
+
"reporter": ["lcov", "text-summary"],
|
|
7
|
+
"report-dir": "coverage/mocha"
|
|
8
|
+
}
|
package/CLAUDE.md
CHANGED
|
@@ -20,6 +20,9 @@ npm test # Full test suite (mocha legacy + jest)
|
|
|
20
20
|
npm run test-jest # Jest tests only
|
|
21
21
|
npm run test-jest-file <path> # Single jest test: npm run test-jest-file tests/jest/components/MyTest.test.tsx
|
|
22
22
|
npm run test-file-ts <path> # Single mocha test: npm run test-file-ts src/components/__tests__/MyTest-test.tsx
|
|
23
|
+
npm run coverage # Both suites with coverage (what CI runs); writes coverage/{mocha,jest}/lcov.info
|
|
24
|
+
npm run coverage-ts # Mocha suite coverage only (nyc)
|
|
25
|
+
npm run coverage-jest # Jest suite coverage only
|
|
23
26
|
npm run dev-test-axe # Dev build with react-axe accessibility checking (output in browser console)
|
|
24
27
|
```
|
|
25
28
|
|
|
@@ -68,6 +71,10 @@ The dev server can also read the backend URL from `.env` or `.env.local` with `B
|
|
|
68
71
|
|
|
69
72
|
2. **Mocha** (legacy): Tests in `src/*/__tests__/` directories. Uses Enzyme with React 16 adapter. Do not add new mocha tests.
|
|
70
73
|
|
|
74
|
+
**Coverage:** Both suites report to Codecov under separate flags (`jest`, `mocha`). Each emits an istanbul `lcov` report — jest natively, mocha via `nyc` (configured in `.nycrc.json`) — so the two agree on which lines are executable and Codecov can merge them into a single union. Do not swap `nyc` for `c8`: c8's V8-based line mapping counts every physical line of a `.ts` file as executable, which reports untested-but-imported modules as 100% covered and corrupts the merge.
|
|
75
|
+
|
|
76
|
+
Jest's `roots` must keep `<rootDir>/src` so `collectCoverageFrom` can discover source files no jest test imports; `testMatch` (not `--roots`) is what keeps jest from picking up the mocha tests under `src/**/__tests__/`.
|
|
77
|
+
|
|
71
78
|
## Code Style
|
|
72
79
|
|
|
73
80
|
- Prettier: double quotes, semicolons, trailing commas (es5), 80 char width
|
package/eslint.config.mjs
CHANGED
|
@@ -8,7 +8,15 @@ import globals from "globals";
|
|
|
8
8
|
|
|
9
9
|
export default tseslint.config(
|
|
10
10
|
{
|
|
11
|
-
ignores: [
|
|
11
|
+
ignores: [
|
|
12
|
+
"dist/",
|
|
13
|
+
"lib/",
|
|
14
|
+
"docs/",
|
|
15
|
+
"typings/",
|
|
16
|
+
"node_modules/",
|
|
17
|
+
"coverage/",
|
|
18
|
+
".nyc_output/",
|
|
19
|
+
],
|
|
12
20
|
},
|
|
13
21
|
js.configs.recommended,
|
|
14
22
|
...tseslint.configs.recommended,
|
package/jest.config.js
CHANGED
|
@@ -13,4 +13,19 @@ module.exports = {
|
|
|
13
13
|
},
|
|
14
14
|
setupFiles: ["./jest.polyfills.js"],
|
|
15
15
|
setupFilesAfterEnv: ["./tests/jest/jest-setup.ts"],
|
|
16
|
+
// `src` must stay in `roots` so that `collectCoverageFrom` can discover source
|
|
17
|
+
// files that no jest test imports — otherwise they are silently omitted from
|
|
18
|
+
// the report rather than counted as uncovered. `testMatch` (not `--roots`) is
|
|
19
|
+
// therefore what keeps jest from picking up the legacy mocha tests that live
|
|
20
|
+
// in `src/**/__tests__/`.
|
|
21
|
+
roots: ["<rootDir>/src", "<rootDir>/tests/jest"],
|
|
22
|
+
testMatch: ["<rootDir>/tests/jest/**/*.test.{js,jsx,ts,tsx}"],
|
|
23
|
+
coverageDirectory: "coverage/jest",
|
|
24
|
+
coverageReporters: ["lcov", "text-summary"],
|
|
25
|
+
collectCoverageFrom: [
|
|
26
|
+
"src/**/*.{ts,tsx}",
|
|
27
|
+
"!src/**/__tests__/**",
|
|
28
|
+
"!src/testHelper.ts",
|
|
29
|
+
"!src/**/*.d.ts",
|
|
30
|
+
],
|
|
16
31
|
};
|
package/package.json
CHANGED
|
@@ -27,8 +27,11 @@
|
|
|
27
27
|
"test-browser": "npm run test-chrome && npm run test-firefox",
|
|
28
28
|
"test-chrome": "node_modules/.bin/selenium-standalone install && nightwatch -e chrome",
|
|
29
29
|
"test-firefox": "node_modules/.bin/selenium-standalone install && nightwatch -e firefox",
|
|
30
|
-
"test-jest": "jest --verbose
|
|
30
|
+
"test-jest": "jest --verbose",
|
|
31
31
|
"test-jest-file": "jest --verbose",
|
|
32
|
+
"coverage": "npm run coverage-ts && npm run coverage-jest",
|
|
33
|
+
"coverage-ts": "nyc npm run test-ts",
|
|
34
|
+
"coverage-jest": "npm run test-jest -- --coverage",
|
|
32
35
|
"dev": "webpack --watch --progress --config webpack.dev.config",
|
|
33
36
|
"dev-server": "dotenv -c -- webpack serve --progress --hot --config webpack.dev-server.config",
|
|
34
37
|
"dev-test-axe": "TEST_AXE=true npm run dev",
|
|
@@ -119,6 +122,7 @@
|
|
|
119
122
|
"mocha": "^11.7.6",
|
|
120
123
|
"msw": "^2.7.3",
|
|
121
124
|
"nightwatch": "^3.14.0",
|
|
125
|
+
"nyc": "^17.1.0",
|
|
122
126
|
"prettier": "3.8.4",
|
|
123
127
|
"react-axe": "^3.3.0",
|
|
124
128
|
"react-test-renderer": "^16.14.0",
|
|
@@ -153,5 +157,5 @@
|
|
|
153
157
|
"*.{js,jsx,ts,tsx,css,md}": "prettier --write",
|
|
154
158
|
"*.{js,css,md}": "prettier --write"
|
|
155
159
|
},
|
|
156
|
-
"version": "1.43.0-post.
|
|
160
|
+
"version": "1.43.0-post.2"
|
|
157
161
|
}
|