Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test:lib task-caching w/ Nx #5116

Merged
merged 20 commits into from
Mar 14, 2023
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
3 changes: 2 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: pr
on: [pull_request]

jobs:
test:
name: 'Test'
Expand All @@ -15,7 +16,7 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- run: pnpm run test:lib
- run: pnpm nx run-many --target=test:lib --parallel=5
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
lint:
Expand Down
39 changes: 39 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["test:lib"]
}
}
},
"defaultBase": "main",
"namedInputs": {
"globalBuildAffectingConfig": [
"{workspaceRoot}/babel.config.js",
"{workspaceRoot}/rollup.config.js",
"{workspaceRoot}/rollup.config.ts",
"{workspaceRoot}/tsconfig.json",
"{workspaceRoot}/tsconfig.base.json"
],
"globalNonBuildAffectingConfig": [
"{workspaceRoot}/.eslintrc",
"{workspaceRoot}/jest-preset.js"
],
"default": ["{projectRoot}/**/*", "globalBuildAffectingConfig", "globalNonBuildAffectingConfig"],
"public": [
"default",
"!{workspaceRoot}/.eslintrc",
"!{workspaceRoot}/jest-preset.js",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/.eslintrc",
"!{projectRoot}/jest.config.js"
TkDodo marked this conversation as resolved.
Show resolved Hide resolved
]
},
"targetDefaults": {
"test:lib": {
"outputs": ["{projectRoot}/coverage"],
"inputs": ["default", "^public"]
}
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test:react:17": "pnpm --filter \"./packages/react-*\" run test:lib",
"test:eslint": "pnpm --filter \"./packages/**\" run test:eslint",
"test:format": "pnpm run prettier --check",
"test:lib": "pnpm --filter \"./packages/**\" run test:lib",
"test:lib": "nx run-many --target=test:lib --parallel=5",
"test:lib:dev": "pnpm --filter \"./packages/**\" run test:lib:dev",
"test:build": "pnpm run build && bundlewatch && pnpm run validatePackages",
"test:types": "pnpm --filter \"./packages/**\" run test:types",
Expand Down Expand Up @@ -91,7 +91,8 @@
"ts-jest": "^27.1.1",
"ts-node": "^10.7.0",
"typescript": "^4.7.4",
"vue": "^3.2.33"
"vue": "^3.2.33",
"nx": "^15.8.6"
},
"bundlewatch": {
"files": [
Expand Down
Loading