nx/packages/vite/src/plugins/__snapshots__/plugin-vitest.spec.ts.snap
Jack Hsu d90a735540
feat(core): add --help content to project details view (#26629)
This PR adds help text for each inferred target that provides
`metadata.help.command`. To pass options/args to the target, users are
directed to open `project.json` and copy the values from `--help` output
into `options` property of the target.

To display the options help section, the inferred target must provide
metadata as follows:

```json5
 metadata: {
      help: {
        command: `foo --help`
        example: {
          options: {
            bar: true
          },
        },
      },
    },
```

The `help.command` value will be used to retrieve help text for the
underlying CLI (e.g. `jest --help`). The `help.example` property
contains sample options and args that users can add to their
`project.json` file -- currently rendered in the hover tooltip of
`project.json` hint text.

---

Example with `vite build --help`:

<img width="1257" alt="Screenshot 2024-06-21 at 3 06 21 PM"
src="https://github.com/nrwl/nx/assets/53559/b94cdcde-80da-4fa5-9f93-11af7fbcaf27">


Result of clicking `Run`:
<img width="1257" alt="Screenshot 2024-06-21 at 3 06 24 PM"
src="https://github.com/nrwl/nx/assets/53559/6803a5a8-9bbd-4510-b9ff-fa895a5b3402">

`project.json` tooltip hint:
<img width="1392" alt="Screenshot 2024-06-25 at 12 44 02 PM"
src="https://github.com/nrwl/nx/assets/53559/565002ae-7993-4dda-ac5d-4b685710f65e">
2024-06-27 13:33:35 -04:00

57 lines
1.3 KiB
Plaintext

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`@nx/vite/plugin root project should create nodes 1`] = `
[
[
"vitest.config.ts",
{
"projects": {
".": {
"metadata": {},
"root": ".",
"targets": {
"test": {
"cache": true,
"command": "vitest",
"inputs": [
"default",
"^production",
{
"externalDependencies": [
"vitest",
],
},
{
"env": "CI",
},
],
"metadata": {
"description": "Run Vite tests",
"help": {
"command": "npx vitest --help",
"example": {
"options": {
"bail": 1,
"coverage": true,
},
},
},
"technologies": [
"vite",
],
},
"options": {
"cwd": ".",
},
"outputs": [
"{projectRoot}/coverage",
],
},
},
},
},
},
],
]
`;