-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
nx-plugin.json
573 lines (573 loc) · 35.6 KB
/
nx-plugin.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
{
"githubRoot": "https://github.com/nrwl/nx/blob/master",
"name": "nx-plugin",
"packageName": "@nrwl/nx-plugin",
"description": "This plugin is used to create Nx plugins! It contains generators for generating common plugin features like generators, executors, migrations and more.",
"root": "/packages/nx-plugin",
"source": "/packages/nx-plugin/src",
"documentation": [
{
"id": "overview",
"name": "Overview",
"path": "/packages/nx-plugin",
"file": "shared/nx-plugin",
"content": "Nx plugins are npm packages that contain generators and executors to extend a Nx workspace. Generators are blueprints to create new files from templates, and executors run those files. These plugins also update the `nx.json` when generating new libs or apps.\n\n> A list of plugins that is maintained by Nrwl is found in the [Nrwl/nx repo](https://github.com/nrwl/nx/tree/master/packages). \\\n> A list of custom plugins created by the community is found in the [Community](/community) section.\n> Plugins are written using Nx Devkit. **Read [Nx Devkit](/devkit/index) for more information.**\n\n{% youtube\nsrc=\"https://www.youtube.com/embed/fC1-4fAZDP4\"\ntitle=\"Nx Tutorial: Building Custom Plugins for Nx\"\nwidth=\"100%\" /%}\n\n> For a detailed video explaining the things covered here and more, check out [Creating and Publishing Your Own Nx Plugin](https://www.youtube.com/watch?v=vVT7Al01VZc).\n\n## Generating a Plugin\n\nTo get started with building a Nx Plugin, run the following command:\n\n```bash\nnpx create-nx-plugin my-org --pluginName my-plugin\n```\n\nThis command creates a brand-new workspace, and sets up a pre-configured plugin with the specified name.\n\n> Note, the command above will create a plugin the package name set to `@my-org/my-plugin`. You can pass `--importPath` to provide a different package name.\n\n> If you do not want to create a new workspace, install the `@nrwl/nx-plugin` dependency in an already existing workspace with npm or yarn. Then run `nx g @nrwl/nx-plugin:plugin [pluginName]`.\n\nA new plugin is created with a default generator, executor, and e2e app.\n\n## Generator\n\nThe created generator contains boilerplate that will do the following:\n\n- Normalize a schema (the options that the generator accepts)\n- Update the `project.json`\n- Add the plugin's project to the `nx.json` file\n- Add files to the disk using templates\n\nThere will be an exported default function that will be the main entry for the generator.\n\n### Generator options\n\nThe `schema.d.ts` file contains all the options that the generator supports. By default, it includes `directory`, `tags`, and `name` as the options. If more options need to be added, please update this file and the `schema.json` file.\n\n{% callout type=\"note\" title=\"More details\" %}\nThe `schema.d.ts` file is used for type checking inside the implementation file. It should match the properties in `schema.json`.\n{% /callout %}\n\n### Adding more generators\n\nTo add more generators to the plugin, run the following command:\n`nx generate @nrwl/nx-plugin:generator [generatorName] --project=[pluginName]`.\n\nThis will scaffold out a new generator and update the necessary files to support it.\n\n### Generator Testing\n\nThe generator spec file includes boilerplate to help get started with testing. This includes setting up an empty workspace.\n\nThese tests should ensure that files within the tree (created with `createTreeWithEmptyWorkspace`) are in the correct place, and contain the right content.\n\nFull E2Es are supported (and recommended) and will run everything on the file system like a user would.\n\n## Executor\n\nThe default executor is set up to just emit a console log. Some examples of what an executor can do are:\n\n- Support different languages, (Java, Go, Python, C#)\n- Compile new UI framework components\n- Deploy an app on a CDN\n- Publish to NPM\n- and many more!\n\n### Adding more executors\n\nTo add more executors to the plugin, run the following command:\n`nx generate @nrwl/nx-plugin:executor [executor] --project=[pluginName]`.\n\nThis will scaffold out a new generator and update the necessary files to support it.\n\n### Executor testing\n\nThe executor spec file contains boilerplate to run the default exported function from the executor.\n\nThese tests should make sure that the executor is executing and calling the functions that it relies on.\n\nFull E2Es are supported (and recommended) and will run everything on the file system like a user would.\n\n## Testing your plugin\n\nOne of the biggest benefits that the Nx Plugin package provides is support for E2E and unit testing.\n\nWhen the E2E app runs, a temporary E2E directory is created in the root of the workspace. This directory is a blank Nx workspace, and will have the plugin's built package installed locally.\n\n### E2E Testing file\n\nWhen the plugin is generated, a test file is created in the `my-plugin-e2e` app. Inside this test file, there are already tests for making sure that the executor ran, checking if directories are created with the `--directory` option, and checking if tags are added to the project configuration.\n\nWe'll go over a few parts of a test file below:\n\n```typescript\nit('should create my-plugin', async (done) => {\n const plugin = uniq('my-plugin');\n ensureNxProject('@my-org/my-plugin', 'dist/packages/my-plugin');\n await runNxCommandAsync(`generate @my-org/my-plugin:myPlugin ${plugin}`);\n\n const result = await runNxCommandAsync(`build ${plugin}`);\n expect(result.stdout).toContain('Executor ran');\n\n done();\n});\n```\n\n- The `uniq` function creates a random name with the prefix and a random number.\n- The `ensureNxProject` is the function that will create the temporary directory. It takes two arguments, the plugin package name and the dist directory of when it's built.\n- The `runNxCommandAsync` will execute a `nx` command in the E2E directory.\n\nThere are additional functions that the `@nrwl/nx-plugin/testing` package exports. Most of them are file utilities to manipulate and read files in the E2E directory.\n\n## Including Assets\n\nSometimes you might want to include some assets with the plugin. This might be a image or some additional binaries.\n\nTo make sure that assets are copied to the dist folder, open the plugin's `project.json` file. Inside the `build` property, add additional assets. By default, all `.md` files in the root, all non-ts files in folders, and the `generators.json` and `executors.json` files are included.\n\n```json\n\"build\": {\n \"executor\": \"@nrwl/node:package\",\n \"options\": {\n // shortened...\n \"assets\": [\n \"packages/my-plugin/*.md\",\n {\n \"input\": \"./packages/my-plugin/src\",\n \"glob\": \"**/*.!(ts)\",\n \"output\": \"./src\"\n },\n {\n \"input\": \"./packages/my-plugin\",\n \"glob\": \"generators.json\",\n \"output\": \".\"\n },\n {\n \"input\": \"./packages/my-plugin\",\n \"glob\": \"executors.json\",\n \"output\": \".\"\n }\n ]\n }\n}\n```\n\n## Using your Nx Plugin\n\nTo use your plugin, simply list it in `nx.json` or use its generators and executors as you would for any other plugin. This could look like `nx g @my-org/my-plugin:lib` for generators or `\"executor\": \"@my-org/my-plugin:build\"` for executors. It should be usable in all of the same ways as published plugins in your local workspace immediately after generating it. This includes setting it up as the default collection in `nx.json`, which would allow you to run `nx g lib` and hit your plugin's generator.\n\n## Publishing your Nx Plugin\n\nIn order to use your plugin in other workspaces or share it with the community, you will need to publish it to an npm registry. To publish your plugin follow these steps:\n\n1. Build your plugin with the command `nx run my-plugin:build`\n1. `npm publish ./dist/package/my-plugin` and follow the prompts from npm.\n1. That's it!\n\n{% callout type=\"warning\" title=\"Version bump\" %}\nCurrently you will have to modify the `package.json` version by yourself or with a tool.\n{% /callout %}\n\nAfter that, you can then install your plugin like any other npm package,\n`npm i -D @my-org/my-plugin` or `yarn add -D @my-org/my-plugin`.\n\n### Listing your Nx Plugin\n\nNx provides a utility (`nx list`) that lists both core and community plugins. To submit your plugin, please follow the steps below:\n\n- Fork the [Nx repo](https://github.com/nrwl/nx/fork) (if you haven't already)\n- Update the [`community/approved-plugins.json` file](https://github.com/nrwl/nx/blob/master/community/approved-plugins.json) with a new entry for your plugin that includes name, url and description\n- Use the following commit message template: `chore(core): nx plugin submission [PLUGIN_NAME]`\n- push your changes, and run `yarn submit-plugin`\n\n> The `yarn submit-plugin` command automatically opens the Github pull request process with the correct template.\n\nWe will then verify the plugin, offer suggestions or merge the pull request!\n\n## Preset\n\nA Preset is a customization option which you provide when creating a new workspace. TS, Node, React are some internal presets that Nx provides by default.\n\n{% youtube\nsrc=\"https://www.youtube.com/embed/yGUrF0-uqaU\"\ntitle=\"Develop a Nx Preset for your Nx Plugin\"\nwidth=\"100%\" /%}\n\n### Custom Preset\n\nAt its core a preset is a generator, which we can create inside of a plugin.\nIf you **don't** have an existing plugin you can create one by running\n\n```bash\n npx create-nx-plugin my-org --pluginName my-plugin\n```\n\nTo create our preset inside of our plugin we can run\n\n```bash\n nx generate @nrwl/nx-plugin:generator --name=preset --project=happynrwl\n```\n\n{% callout type=\"warning\" title=\"Double check\" %}\nThe word `preset` is required for the name of this generator\n{% /callout %}\n\nYou should have a similar structure to this:\n\n```treeview\nhappynrwl/\n\t├── e2e\n\t├── jest.config.js\n\t├── jest.preset.js\n\t├── nx.json\n\t├── package-lock.json\n\t├── package.json\n\t├── packages\n\t│ └── happynrwl\n\t│ ├── src\n\t│ │ ├── executors\n\t│ │ ├── generators\n\t│ │ │ ├── happynrwl\n\t│ │ │ └── preset \t\t// <------------- Here\n\t│ │ └── index.ts\n\t├── tools\n\t└── tsconfig.base.json\n```\n\nAfter the command is finished, the preset generator is created under the folder named **preset**.\nThe **generator.ts** provides an entry point to the generator. This file contains a function that is called to perform manipulations on a tree that represents the file system. The **schema.json** provides a description of the generator, available options, validation information, and default values.\n\nHere is the sample generator function which you can customize to meet your needs.\n\n```typescript\nexport default async function (tree: Tree, options: PresetGeneratorSchema) {\n const normalizedOptions = normalizeOptions(tree, options);\n addProjectConfiguration(tree, normalizedOptions.projectName, {\n root: normalizedOptions.projectRoot,\n projectType: 'application',\n sourceRoot: `${normalizedOptions.projectRoot}/src`,\n targets: {\n exec: {\n executor: 'nx:run-commands',\n options: {\n command: `node ${projectRoot}/src/index.js`,\n },\n },\n },\n tags: normalizedOptions.parsedTags,\n });\n addFiles(tree, normalizedOptions);\n await formatFiles(tree);\n}\n```\n\nTo get an in-depth guide on customizing/running or debugging your generator see [local generators](/recipe/local-generators).\n\n#### Usage\n\nBefore you are able to use your newly created preset you must package and publish it to a registry.\n\nAfter you have published your plugin to a registry you can now use your preset when creating a new workspace\n\n```bash\nnpx create-nx-workspace my-workspace --preset=my-plugin-name\n```\n"
}
],
"generators": [
{
"name": "plugin",
"factory": "./src/generators/plugin/plugin",
"schema": {
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"$id": "NxPluginPlugin",
"title": "Create a Plugin for Nx",
"description": "Create a Plugin for Nx.",
"type": "object",
"examples": [
{
"command": "g plugin my-plugin --directory=plugins --importPath=@myorg/my-plugin",
"description": "Generate `libs/plugins/my-plugin`"
}
],
"properties": {
"name": {
"type": "string",
"description": "Plugin name",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the plugin?"
},
"directory": {
"type": "string",
"description": "A directory where the plugin is placed.",
"alias": "d"
},
"importPath": {
"type": "string",
"description": "How the plugin will be published, like `@myorg/my-awesome-plugin`. Note this must be a valid NPM name."
},
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint"],
"default": "eslint"
},
"unitTestRunner": {
"type": "string",
"enum": ["jest", "none"],
"description": "Test runner to use for unit tests.",
"default": "jest"
},
"tags": {
"type": "string",
"description": "Add tags to the library (used for linting).",
"alias": "t"
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
},
"skipTsConfig": {
"type": "boolean",
"default": false,
"description": "Do not update tsconfig.json for development experience."
},
"skipLintChecks": {
"type": "boolean",
"default": false,
"description": "Do not eslint configuration for plugin json files."
},
"e2eTestRunner": {
"type": "string",
"enum": ["jest", "none"],
"description": "Test runner to use for end to end (E2E) tests.",
"default": "jest"
},
"standaloneConfig": {
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
"type": "boolean"
},
"setParserOptionsProject": {
"type": "boolean",
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
"default": false
},
"compiler": {
"type": "string",
"enum": ["tsc", "swc"],
"default": "tsc",
"description": "The compiler used by the build and test targets."
},
"minimal": {
"type": "boolean",
"description": "Generate the plugin with a minimal setup. This would involve not generating a default executor and generator.",
"default": false
}
},
"required": ["name"],
"additionalProperties": false,
"presets": []
},
"description": "Create a Nx Plugin.",
"implementation": "/packages/nx-plugin/src/generators/plugin/plugin.ts",
"aliases": [],
"hidden": false,
"path": "/packages/nx-plugin/src/generators/plugin/schema.json"
},
{
"name": "e2e-project",
"factory": "./src/generators/e2e-project/e2e",
"schema": {
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"$id": "NxPluginE2E",
"title": "Create an E2E app for a Nx Plugin",
"description": "Create an E2E app for a Nx Plugin.",
"type": "object",
"properties": {
"pluginName": {
"type": "string",
"description": "the name of the plugin to be tested."
},
"npmPackageName": {
"type": "string",
"description": "the name of the package that would be published to NPM."
},
"projectDirectory": {
"type": "string",
"description": "the directory where the plugin is placed."
},
"pluginOutputPath": {
"type": "string",
"description": "the output path of the plugin after it builds."
},
"jestConfig": {
"type": "string",
"description": "Jest config file."
},
"tsSpecConfig": {
"type": "string",
"description": "Spec `tsconfig` file.",
"x-deprecated": true
},
"standaloneConfig": {
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
"type": "boolean"
},
"minimal": {
"type": "boolean",
"description": "Generate the e2e project with a minimal setup. This would involve not generating tests for a default executor and generator.",
"default": false
}
},
"required": ["pluginName", "npmPackageName"],
"additionalProperties": false,
"presets": []
},
"description": "Create a E2E application for a Nx Plugin.",
"hidden": true,
"implementation": "/packages/nx-plugin/src/generators/e2e-project/e2e.ts",
"aliases": [],
"path": "/packages/nx-plugin/src/generators/e2e-project/schema.json"
},
{
"name": "migration",
"factory": "./src/generators/migration/migration",
"schema": {
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"$id": "NxPluginMigration",
"title": "Create a Migration for an Nx Plugin",
"description": "Create a Migration for an Nx Plugin.",
"type": "object",
"examples": [
{
"command": "nx g migration my-migration --project=my-plugin --version=1.0.0",
"description": "Generate `libs/my-plugin/src/migrations/my-migration`"
}
],
"properties": {
"project": {
"type": "string",
"description": "The name of the project.",
"alias": "p",
"$default": { "$source": "projectName" },
"x-prompt": "What is the name of the project for the migration?"
},
"name": {
"type": "string",
"description": "Migration name.",
"$default": { "$source": "argv", "index": 0 }
},
"description": {
"type": "string",
"description": "Migration description.",
"alias": "d"
},
"packageVersion": {
"type": "string",
"description": "Version to use for the migration.",
"alias": "v",
"x-prompt": "What version would you like to use for the migration?"
},
"packageJsonUpdates": {
"type": "boolean",
"description": "Whether or not to include `package.json` updates.",
"alias": "p",
"default": false
}
},
"required": ["project", "packageVersion"],
"additionalProperties": false,
"presets": []
},
"description": "Create a migration for an Nx Plugin.",
"implementation": "/packages/nx-plugin/src/generators/migration/migration.ts",
"aliases": [],
"hidden": false,
"path": "/packages/nx-plugin/src/generators/migration/schema.json"
},
{
"name": "generator",
"factory": "./src/generators/generator/generator",
"schema": {
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"$id": "NxPluginGenerator",
"title": "Create a Generator for an Nx Plugin",
"description": "Create a Generator for an Nx Plugin.",
"type": "object",
"examples": [
{
"command": "nx g generator my-generator --project=my-plugin",
"description": "Generate `libs/my-plugin/src/generators/my-generator`"
}
],
"properties": {
"project": {
"type": "string",
"description": "The name of the project.",
"alias": "p",
"$default": { "$source": "projectName" },
"x-prompt": "What is the name of the project for the generator?"
},
"name": {
"type": "string",
"description": "Generator name.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the generator?"
},
"description": {
"type": "string",
"description": "Generator description.",
"alias": "d"
},
"unitTestRunner": {
"type": "string",
"enum": ["jest", "none"],
"description": "Test runner to use for unit tests.",
"default": "jest"
}
},
"required": ["project", "name"],
"additionalProperties": false,
"presets": []
},
"description": "Create a generator for an Nx Plugin.",
"implementation": "/packages/nx-plugin/src/generators/generator/generator.ts",
"aliases": [],
"hidden": false,
"path": "/packages/nx-plugin/src/generators/generator/schema.json"
},
{
"name": "executor",
"factory": "./src/generators/executor/executor",
"schema": {
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"$id": "NxPluginExecutor",
"title": "Create an Executor for an Nx Plugin",
"description": "Create an Executor for an Nx Plugin.",
"type": "object",
"examples": [
{
"command": "nx g executor my-executor --project=my-plugin",
"description": "Generate `libs/my-plugin/src/executors/my-executor`"
}
],
"properties": {
"project": {
"type": "string",
"description": "The name of the project.",
"alias": "p",
"$default": { "$source": "projectName" },
"x-prompt": "What is the name of the project for the executor?"
},
"name": {
"type": "string",
"description": "Executor name.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the executor?"
},
"description": {
"type": "string",
"description": "Executor description.",
"alias": "d"
},
"unitTestRunner": {
"type": "string",
"enum": ["jest", "none"],
"description": "Test runner to use for unit tests.",
"default": "jest"
},
"includeHasher": {
"type": "boolean",
"default": false,
"description": "Should the boilerplate for a custom hasher be generated?"
}
},
"required": ["project", "name"],
"additionalProperties": false,
"presets": []
},
"description": "Create an executor for an Nx Plugin.",
"implementation": "/packages/nx-plugin/src/generators/executor/executor.ts",
"aliases": [],
"hidden": false,
"path": "/packages/nx-plugin/src/generators/executor/schema.json"
},
{
"name": "plugin-lint-checks",
"factory": "./src/generators/lint-checks/generator",
"schema": {
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"$id": "PluginLint",
"title": "",
"type": "object",
"description": "Adds linting configuration to validate common json files for nx plugins.",
"properties": {
"projectName": {
"type": "string",
"description": "Which project should be the configuration be added to?",
"$default": { "$source": "projectName" }
}
},
"required": ["projectName"],
"presets": []
},
"description": "Adds linting configuration to validate common json files for nx plugins.",
"implementation": "/packages/nx-plugin/src/generators/lint-checks/generator.ts",
"aliases": [],
"hidden": false,
"path": "/packages/nx-plugin/src/generators/lint-checks/schema.json"
}
],
"executors": [
{
"name": "e2e",
"implementation": "/packages/nx-plugin/src/executors/e2e/e2e.impl.ts",
"schema": {
"version": 2,
"outputCapture": "direct-nodejs",
"title": "Nx Plugin Playground Target",
"description": "Creates a playground for a Nx Plugin.",
"cli": "nx",
"type": "object",
"properties": {
"target": {
"description": "The build target for the Nx Plugin project.",
"type": "string"
},
"jestConfig": {
"type": "string",
"description": "Jest config file.",
"x-completion-type": "file",
"x-completion-glob": "jest.config@(.js|.ts)"
},
"tsSpecConfig": {
"type": "string",
"description": "The tsconfig file for specs.",
"x-deprecated": "Use the `tsconfig` property for `ts-jest` in the e2e project `jest.config.js` file. It will be removed in the next major release.",
"x-completion-type": "file",
"x-completion-glob": "tsconfig.*.json"
},
"codeCoverage": {
"description": "Indicates that test coverage information should be collected and reported in the output. (https://jestjs.io/docs/cli#--coverageboolean)",
"type": "boolean",
"aliases": ["coverage"]
},
"config": {
"description": "The path to a Jest config file specifying how to find and execute tests. If no `rootDir` is set in the config, the directory containing the config file is assumed to be the `rootDir` for the project. This can also be a JSON-encoded value which Jest will use as configuration.",
"type": "string"
},
"clearCache": {
"description": "Deletes the Jest cache directory and then exits without running tests. Will delete Jest's default cache directory. _Note: clearing the cache will reduce performance_.",
"type": "boolean"
},
"detectOpenHandles": {
"description": "Attempt to collect and print open handles preventing Jest from exiting cleanly (https://jestjs.io/docs/cli#--detectopenhandles)",
"type": "boolean"
},
"logHeapUsage": {
"description": "Logs the heap usage after every test. Useful to debug memory leaks. Use together with --runInBand and --expose-gc in node.",
"type": "boolean"
},
"detectLeaks": {
"description": "**EXPERIMENTAL**: Detect memory leaks in tests. After executing a test, it will try to garbage collect the global object used, and fail if it was leaked",
"type": "boolean"
},
"testFile": {
"description": "The name of the file to test.",
"type": "string",
"x-completion-type": "file",
"x-completion-glob": "**/*.+(spec|test).+(ts|js)"
},
"tsConfig": {
"description": "The name of the Typescript configuration file. Set the tsconfig option in the jest config file. ",
"type": "string",
"x-deprecated": true
},
"setupFile": {
"description": "The name of a setup file used by Jest. (use Jest config file https://jestjs.io/docs/en/configuration#setupfilesafterenv-array)",
"type": "string",
"x-deprecated": true
},
"bail": {
"alias": "b",
"description": "Exit the test suite immediately after `n` number of failing tests. (https://jestjs.io/docs/cli#--bail)",
"oneOf": [{ "type": "number" }, { "type": "boolean" }]
},
"ci": {
"description": "Whether to run Jest in continuous integration (CI) mode. This option is on by default in most popular CI environments. It will prevent snapshots from being written unless explicitly requested. (https://jestjs.io/docs/cli#--ci)",
"type": "boolean"
},
"color": {
"alias": "colors",
"description": "Forces test results output color highlighting (even if `stdout` is not a TTY). Set to false if you would like to have no colors. (https://jestjs.io/docs/cli#--colors)",
"type": "boolean"
},
"findRelatedTests": {
"description": "Find and run the tests that cover a comma separated list of source files that were passed in as arguments. (https://jestjs.io/docs/cli#--findrelatedtests-spaceseparatedlistofsourcefiles)",
"type": "string"
},
"json": {
"description": "Prints the test results in `JSON`. This mode will send all other test output and user messages to `stderr`. (https://jestjs.io/docs/cli#--json)",
"type": "boolean"
},
"maxWorkers": {
"alias": "w",
"description": "Specifies the maximum number of workers the worker-pool will spawn for running tests. This defaults to the number of the cores available on your machine. Useful for CI. (its usually best not to override this default) (https://jestjs.io/docs/cli#--maxworkersnumstring)",
"oneOf": [{ "type": "number" }, { "type": "string" }]
},
"onlyChanged": {
"alias": "o",
"description": "Attempts to identify which tests to run based on which files have changed in the current repository. Only works if you're running tests in a `git` or `hg` repository at the moment. (https://jestjs.io/docs/cli#--onlychanged)",
"type": "boolean"
},
"changedSince": {
"description": "Runs tests related to the changes since the provided branch or commit hash. If the current branch has diverged from the given branch, then only changes made locally will be tested. (https://jestjs.io/docs/cli#--changedsince)",
"type": "string"
},
"outputFile": {
"description": "Write test results to a file when the `--json` option is also specified. (https://jestjs.io/docs/cli#--outputfilefilename)",
"type": "string"
},
"passWithNoTests": {
"description": "Will not fail if no tests are found (for example while using `--testPathPattern`.) (https://jestjs.io/docs/cli#--passwithnotests)",
"type": "boolean"
},
"runInBand": {
"alias": "i",
"description": "Run all tests serially in the current process (rather than creating a worker pool of child processes that run tests). This is sometimes useful for debugging, but such use cases are pretty rare. Useful for CI. (https://jestjs.io/docs/cli#--runinband)",
"type": "boolean"
},
"showConfig": {
"description": "Print your Jest config and then exits. (https://jestjs.io/docs/en/cli#--showconfig)",
"type": "boolean"
},
"silent": {
"description": "Prevent tests from printing messages through the console. (https://jestjs.io/docs/cli#--silent)",
"type": "boolean"
},
"testNamePattern": {
"alias": "t",
"description": "Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/cli#--testnamepatternregex)",
"type": "string"
},
"testPathIgnorePatterns": {
"description": "An array of regexp pattern strings that is matched against all tests paths before executing the test. Only run those tests with a path that does not match with the provided regexp expressions. (https://jestjs.io/docs/cli#--testpathignorepatternsregexarray)",
"type": "array",
"items": { "type": "string" }
},
"testPathPattern": {
"description": "An array of regexp pattern strings that is matched against all tests paths before executing the test. (https://jestjs.io/docs/cli#--testpathpatternregex)",
"type": "array",
"items": { "type": "string" },
"default": []
},
"colors": {
"description": "Forces test results output highlighting even if stdout is not a TTY. (https://jestjs.io/docs/cli#--colors)",
"type": "boolean"
},
"reporters": {
"description": "Run tests with specified reporters. Reporter options are not available via CLI. Example with multiple reporters: `jest --reporters=\"default\" --reporters=\"jest-junit\"`. (https://jestjs.io/docs/cli#--reporters)",
"type": "array",
"items": { "type": "string" }
},
"verbose": {
"description": "Display individual test results with the test suite hierarchy. (https://jestjs.io/docs/cli#--verbose)",
"type": "boolean"
},
"coverageReporters": {
"description": "A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter.",
"type": "array",
"items": { "type": "string" }
},
"coverageDirectory": {
"description": "The directory where Jest should output its coverage files.",
"type": "string"
},
"testResultsProcessor": {
"description": "Node module that implements a custom results processor. (https://jestjs.io/docs/en/configuration#testresultsprocessor-string)",
"type": "string"
},
"updateSnapshot": {
"alias": "u",
"description": "Use this flag to re-record snapshots. Can be used together with a test suite pattern or with `--testNamePattern` to re-record snapshot for test matching the pattern. (https://jestjs.io/docs/cli#--updatesnapshot)",
"type": "boolean"
},
"useStderr": {
"description": "Divert all output to stderr.",
"type": "boolean"
},
"watch": {
"description": "Watch files for changes and rerun tests related to changed files. If you want to re-run all tests when a file has changed, use the `--watchAll` option. (https://jestjs.io/docs/cli#--watch)",
"type": "boolean"
},
"watchAll": {
"description": "Watch files for changes and rerun all tests when something changes. If you want to re-run only the tests that depend on the changed files, use the `--watch` option. (https://jestjs.io/docs/cli#--watchall)",
"type": "boolean"
},
"testLocationInResults": {
"description": "Adds a location field to test results. Used to report location of a test in a reporter. { \"column\": 4, \"line\": 5 } (https://jestjs.io/docs/cli#--testlocationinresults)",
"type": "boolean"
},
"testTimeout": {
"description": "Default timeout of a test in milliseconds. Default value: `5000`. (https://jestjs.io/docs/cli#--testtimeoutnumber)",
"type": "number"
}
},
"additionalProperties": false,
"required": ["target", "jestConfig"],
"presets": []
},
"description": "Creates and runs the E2E tests for an Nx Plugin.",
"aliases": [],
"hidden": false,
"path": "/packages/nx-plugin/src/executors/e2e/schema.json"
}
]
}