Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test

on:
pull_request:
push:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
coverage/
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Full rollout process: the `shared-changes-workflow` and `bump-shared-ref` skills

## Tests

`yarn test` (Jest + jsdom). Mock `react-admin` and `@shared/*` imports with `jest.mock`; assert on wiring, not fetched data — no live backend. See the `write-tests` skill.
Standalone: `yarn install && yarn test` from the repo root (Jest + jsdom; config lives in `package.json`, `@shared/*` maps to the repo root). CI (`.github/workflows/test.yml`) runs this on every PR and push to `main`. Consumers still run these tests via `client/shared` with their own Jest config. Test deps are duplicated from the consumers' `client/package.json` — keep versions in sync when they change. Mock `react-admin` and `@shared/*` imports with `jest.mock`; assert on wiring, not fetched data — no live backend. See the `write-tests` skill.

## Task tracking

Expand Down
63 changes: 63 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "nra-client-shared",
"version": "0.0.0",
"private": true,
"description": "Shared NRA React-Admin client library. Mounted as client/shared in consumer projects; this package exists only to run its tests standalone.",
"scripts": {
"test": "jest"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@nestjsx/crud-request": "^5.0.0-alpha.3",
"@openobserve/browser-logs": "^0.2.11",
"@openobserve/browser-rum": "^0.2.11",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
"babel-jest": "^29.7.0",
"file-saver": "^2.0.5",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jewish-date": "^2.0.8",
"ra-data-nestjsx-crud": "^1.3.2",
"ra-input-rich-text": "^4.10.1",
"ra-language-hebrew-il": "^3.9.6",
"react": "^18.2.0",
"react-admin": "^5.3.3",
"react-admin-json-view": "^2.0.0",
"react-dom": "^18.2.0",
"react-test-renderer": "^18.2.0",
"stylis": "^4.1.3",
"stylis-plugin-rtl": "^2.1.1",
"whatwg-fetch": "^3.6.20",
"xlsx": "^0.18.5"
},
"jest": {
"testEnvironment": "jsdom",
"moduleNameMapper": {
"^src/(.*)$": "<rootDir>/src/$1",
"^@shared/(.*)$": "<rootDir>/$1"
},
"setupFilesAfterEnv": [
"@testing-library/jest-dom",
"whatwg-fetch"
],
"transform": {
"\\.[jt]sx?$": [
"babel-jest",
{
"babelrc": false,
"configFile": false,
"presets": [
"@babel/preset-typescript",
"@babel/preset-env",
["@babel/preset-react", { "runtime": "automatic" }]
]
}
]
}
}
}
Loading
Loading