Skip to content

Commit 6092966

Browse files
authored
feat(core): add PLUGIN.md files to testing-tools (#34125)
Add PLUGIN.md files to test related plugins Closes NXA-789
1 parent 2544227 commit 6092966

9 files changed

Lines changed: 185 additions & 0 deletions

File tree

packages/cypress/PLUGIN.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Cypress
2+
3+
After making changes to a project, run the relevant test file to verify your changes work correctly.
4+
5+
## Mode Detection
6+
7+
Check in order (first match wins):
8+
9+
| Mode | Detection |
10+
| --------- | ------------------------------------------------------ |
11+
| Atomized | `ciTargetName` in nx.json `@nx/cypress` plugin options |
12+
| Inference | `@nx/cypress/plugin` in nx.json plugins array |
13+
| Executor | `@nx/cypress:cypress` executor in project.json targets |
14+
15+
## Run Specific Test File
16+
17+
### Atomized
18+
19+
```bash
20+
nx run <project>:<ciTargetName>--<path/to/file.cy.ts>
21+
# Example: nx run my-app-e2e:e2e-ci--src/login.cy.ts
22+
```
23+
24+
### Inference
25+
26+
```bash
27+
nx e2e <project> -- --spec=<path/to/file.cy.ts>
28+
```
29+
30+
### Executor
31+
32+
```bash
33+
nx run <project>:e2e --spec=<path/to/file.cy.ts>
34+
```
35+
36+
## Quick Reference
37+
38+
| Task | Atomized | Inference | Executor |
39+
| ----------- | ------------------------------------- | --------------------------------------- | ---------------------------------------- |
40+
| Run file | `nx run proj:e2e-ci--path/file.cy.ts` | `nx e2e proj -- --spec=path/file.cy.ts` | `nx run proj:e2e --spec=path/file.cy.ts` |
41+
| Run pattern | N/A | `nx e2e proj -- --spec="**/*login*"` | `nx run proj:e2e --spec="**/*login*"` |

packages/cypress/project.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
"glob": "**/*.d.ts",
4242
"output": "/"
4343
},
44+
{
45+
"input": "packages/cypress",
46+
"glob": "PLUGIN.md",
47+
"output": "/"
48+
},
4449
{
4550
"input": "",
4651
"glob": "LICENSE",

packages/jest/PLUGIN.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Jest
2+
3+
After making changes to a project, run the relevant test file to verify your changes work correctly.
4+
5+
## Mode Detection
6+
7+
Check in order (first match wins):
8+
9+
| Mode | Detection |
10+
| --------- | --------------------------------------------------- |
11+
| Atomized | `ciTargetName` in nx.json `@nx/jest` plugin options |
12+
| Inference | `@nx/jest/plugin` in nx.json plugins array |
13+
| Executor | `@nx/jest:jest` executor in project.json targets |
14+
15+
## Run Specific Test File
16+
17+
### Atomized
18+
19+
```bash
20+
nx run <project>:<ciTargetName>--<path/to/file.spec.ts>
21+
# Example: nx run my-lib:test-ci--src/utils.spec.ts
22+
```
23+
24+
### Inference
25+
26+
```bash
27+
nx test <project> -- --testPathPattern=<path/to/file.spec.ts>
28+
```
29+
30+
### Executor
31+
32+
```bash
33+
nx run <project>:test --testFile=<path/to/file.spec.ts>
34+
```
35+
36+
## Quick Reference
37+
38+
| Task | Atomized | Inference | Executor |
39+
| ----------- | ---------------------------------------- | ----------------------------------------------------- | ----------------------------------------------- |
40+
| Run file | `nx run proj:test-ci--path/file.spec.ts` | `nx test proj -- --testPathPattern=path/file.spec.ts` | `nx run proj:test --testFile=path/file.spec.ts` |
41+
| Run pattern | N/A | `nx test proj -- -t "pattern"` | `nx run proj:test --testNamePattern="pattern"` |

packages/jest/project.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
"glob": "**/*.d.ts",
4141
"output": "/"
4242
},
43+
{
44+
"input": "packages/jest",
45+
"glob": "PLUGIN.md",
46+
"output": "/"
47+
},
4348
{
4449
"input": "",
4550
"glob": "LICENSE",

packages/nx/src/ai/set-up-ai-agents/get-agent-rules.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ export function getAgentRules(nxCloud: boolean) {
88
- When working in individual projects, use the \`nx_project_details\` mcp tool to analyze and understand the specific project structure and dependencies
99
- For questions around nx configuration, best practices or if you're unsure, use the \`nx_docs\` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
1010
- If the user needs help with an Nx configuration or project graph error, use the \`nx_workspace\` tool to get any errors
11+
- For Nx plugin best practices, check \`node_modules/@nx/<plugin>/PLUGIN.md\`. Not all plugins have this file - proceed without it if unavailable.
1112
`;
1213
}

packages/playwright/PLUGIN.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Playwright
2+
3+
After making changes to a project, run the relevant test file to verify your changes work correctly.
4+
5+
## Mode Detection
6+
7+
Check in order (first match wins):
8+
9+
| Mode | Detection |
10+
| --------- | ------------------------------------------------------------ |
11+
| Atomized | `ciTargetName` in nx.json `@nx/playwright` plugin options |
12+
| Inference | `@nx/playwright/plugin` in nx.json plugins array |
13+
| Executor | `@nx/playwright:playwright` executor in project.json targets |
14+
15+
## Run Specific Test File
16+
17+
### Atomized
18+
19+
```bash
20+
nx run <project>:<ciTargetName>--<path/to/file.spec.ts>
21+
# Example: nx run my-app-e2e:e2e-ci--src/login.spec.ts
22+
```
23+
24+
### Inference
25+
26+
```bash
27+
nx e2e <project> -- <path/to/file.spec.ts>
28+
```
29+
30+
### Executor
31+
32+
```bash
33+
nx run <project>:e2e --testFiles=<path/to/file.spec.ts>
34+
```
35+
36+
## Quick Reference
37+
38+
| Task | Atomized | Inference | Executor |
39+
| ----------- | --------------------------------------- | ---------------------------------- | ----------------------------------------------- |
40+
| Run file | `nx run proj:e2e-ci--path/file.spec.ts` | `nx e2e proj -- path/file.spec.ts` | `nx run proj:e2e --testFiles=path/file.spec.ts` |
41+
| Run pattern | N/A | `nx e2e proj -- --grep="pattern"` | `nx run proj:e2e --grep="pattern"` |

packages/playwright/project.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
"glob": "**/*.d.ts",
4141
"output": "/"
4242
},
43+
{
44+
"input": "packages/playwright",
45+
"glob": "PLUGIN.md",
46+
"output": "/"
47+
},
4348
{
4449
"input": "",
4550
"glob": "LICENSE",

packages/vitest/PLUGIN.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Vitest
2+
3+
After making changes to a project, run the relevant test file to verify your changes work correctly.
4+
5+
## Mode Detection
6+
7+
Check in order (first match wins):
8+
9+
| Mode | Detection |
10+
| --------- | ------------------------------------------------------------------- |
11+
| Atomized | `ciTargetName` in nx.json `@nx/vitest` or `@nx/vite` plugin options |
12+
| Inference | `@nx/vitest` or `@nx/vite/plugin` in nx.json plugins array |
13+
| Executor | `@nx/vitest:test` executor in project.json targets |
14+
15+
## Run Specific Test File
16+
17+
### Atomized
18+
19+
```bash
20+
nx run <project>:<ciTargetName>--<path/to/file.spec.ts>
21+
# Example: nx run my-lib:test-ci--src/utils.spec.ts
22+
```
23+
24+
### Inference
25+
26+
```bash
27+
nx test <project> -- <path/to/file.spec.ts>
28+
```
29+
30+
### Executor
31+
32+
```bash
33+
nx run <project>:test --testFile=<path/to/file.spec.ts>
34+
```
35+
36+
## Quick Reference
37+
38+
| Task | Atomized | Inference | Executor |
39+
| ----------- | ---------------------------------------- | ----------------------------------- | ----------------------------------------------- |
40+
| Run file | `nx run proj:test-ci--path/file.spec.ts` | `nx test proj -- path/file.spec.ts` | `nx run proj:test --testFile=path/file.spec.ts` |
41+
| Run pattern | N/A | `nx test proj -- -t "pattern"` | `nx run proj:test --testNamePattern="pattern"` |

packages/vitest/project.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
"glob": "**/*.d.ts",
4141
"output": "/"
4242
},
43+
{
44+
"input": "packages/vitest",
45+
"glob": "PLUGIN.md",
46+
"output": "/"
47+
},
4348
{
4449
"input": "",
4550
"glob": "LICENSE",

0 commit comments

Comments
 (0)