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
10 changes: 10 additions & 0 deletions docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2219,6 +2219,16 @@
}
},
"migrations": {
"/nx-api/jest/migrations/remove-tsconfig-option-from-jest-executor": {
"description": "Remove the previously deprecated and unused `tsConfig` option from the `@nx/jest:jest` executor.",
"file": "generated/packages/jest/migrations/remove-tsconfig-option-from-jest-executor.json",
"hidden": false,
"name": "remove-tsconfig-option-from-jest-executor",
"version": "21.0.0-beta.10",
"originalFilePath": "/packages/jest",
"path": "/nx-api/jest/migrations/remove-tsconfig-option-from-jest-executor",
"type": "migration"
},
"/nx-api/jest/migrations/replace-getJestProjects-with-getJestProjectsAsync-v21": {
"description": "Replace usage of `getJestProjects` with `getJestProjectsAsync`.",
"file": "generated/packages/jest/migrations/replace-getJestProjects-with-getJestProjectsAsync-v21.json",
Expand Down
10 changes: 10 additions & 0 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,16 @@
}
],
"migrations": [
{
"description": "Remove the previously deprecated and unused `tsConfig` option from the `@nx/jest:jest` executor.",
"file": "generated/packages/jest/migrations/remove-tsconfig-option-from-jest-executor.json",
"hidden": false,
"name": "remove-tsconfig-option-from-jest-executor",
"version": "21.0.0-beta.10",
"originalFilePath": "/packages/jest",
"path": "jest/migrations/remove-tsconfig-option-from-jest-executor",
"type": "migration"
},
{
"description": "Replace usage of `getJestProjects` with `getJestProjectsAsync`.",
"file": "generated/packages/jest/migrations/replace-getJestProjects-with-getJestProjectsAsync-v21.json",
Expand Down
7 changes: 1 addition & 6 deletions docs/generated/packages/jest/executors/jest.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,10 @@
"type": "string",
"$default": { "$source": "argv", "index": 0 }
},
"tsConfig": {
"description": "The name of the Typescript configuration file.",
"type": "string",
"x-deprecated": "Use the ts-jest configuration options in the jest config file instead."
},
"setupFile": {
"description": "The name of a setup file used by Jest.",
"type": "string",
"x-deprecated": "Use the setupFilesAfterEnv option in the jest config file. https://jestjs.io/docs/en/configuration#setupfilesafterenv-array"
"x-deprecated": "Use the `setupFilesAfterEnv` option in the Jest configuration file instead. See https://jestjs.io/docs/configuration#setupfilesafterenv-array. It will be removed in Nx v22."
},
"bail": {
"alias": "b",
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/packages/jest/generators/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"type": "boolean",
"description": "Skips the setup file required for angular.",
"default": false,
"x-deprecated": "Use `--setup-file` instead."
"x-deprecated": "Use the `setupFile` option instead. It will be removed in Nx v22."
},
"setupFile": {
"type": "string",
Expand Down Expand Up @@ -56,7 +56,7 @@
"type": "boolean",
"alias": "babel-jest",
"description": "Use `babel-jest` instead of `ts-jest`.",
"x-deprecated": "Use `--compiler=babel` instead.",
"x-deprecated": "Use the `compiler` option instead. It will be removed in Nx v22.",
"default": false
},
"skipFormat": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "remove-tsconfig-option-from-jest-executor",
"version": "21.0.0-beta.10",
"description": "Remove the previously deprecated and unused `tsConfig` option from the `@nx/jest:jest` executor.",
"implementation": "/packages/jest/src/migrations/update-21-0-0/remove-tsconfig-option-from-jest-executor.ts",
"aliases": [],
"hidden": false,
"path": "/packages/jest",
"schema": null,
"type": "migration",
"examplesFile": "#### Remove `tsConfig` Option from Jest Executor\n\nRemoves the previously deprecated and unused `tsConfig` option from the `@nx/jest:jest` executor configuration in all projects.\n\n#### Examples\n\nRemove the option from the project configuration:\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"apps/myapp/project.json\" highlightLines=[7] %}\n{\n \"targets\": {\n \"test\": {\n \"executor\": \"@nx/jest:jest\",\n \"options\": {\n \"jestConfig\": \"apps/myapp/jest.config.ts\",\n \"tsConfig\": \"apps/myapp/tsconfig.spec.json\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```json {% fileName=\"apps/myapp/project.json\" %}\n{\n \"targets\": {\n \"test\": {\n \"executor\": \"@nx/jest:jest\",\n \"options\": {\n \"jestConfig\": \"apps/myapp/jest.config.ts\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n\nRemove the option from a target default using the `@nx/jest:jest` executor:\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"nx.json\" highlightLines=[7] %}\n{\n \"targetDefaults\": {\n \"test\": {\n \"executor\": \"@nx/jest:jest\",\n \"options\": {\n \"jestConfig\": \"{projectRoot}/jest.config.ts\",\n \"tsConfig\": \"{projectRoot}/tsconfig.spec.json\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {\n \"test\": {\n \"executor\": \"@nx/jest:jest\",\n \"options\": {\n \"jestConfig\": \"{projectRoot}/jest.config.ts\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n\nRemove the option from a target default using the `@nx/jest:jest` executor as the key:\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"nx.json\" highlightLines=[6] %}\n{\n \"targetDefaults\": {\n \"@nx/jest:jest\": {\n \"options\": {\n \"jestConfig\": \"{projectRoot}/jest.config.ts\",\n \"tsConfig\": \"{projectRoot}/tsconfig.spec.json\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {\n \"@nx/jest:jest\": {\n \"options\": {\n \"jestConfig\": \"{projectRoot}/jest.config.ts\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n"
}
4 changes: 3 additions & 1 deletion packages/jest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { configurationGenerator } from './src/generators/configuration/configura
export { configurationGenerator };

// Exported for backwards compatibility in case a plugin is using the old name.
/** @deprecated Use `configurationGenerator` instead. */
/**
* @deprecated Use `configurationGenerator` instead. It will be removed in Nx v22.
*/
export const jestProjectGenerator = configurationGenerator;

export {
Expand Down
5 changes: 5 additions & 0 deletions packages/jest/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"version": "21.0.0-beta.9",
"description": "Replace usage of `getJestProjects` with `getJestProjectsAsync`.",
"implementation": "./src/migrations/update-21-0-0/replace-getJestProjects-with-getJestProjectsAsync"
},
"remove-tsconfig-option-from-jest-executor": {
"version": "21.0.0-beta.10",
"description": "Remove the previously deprecated and unused `tsConfig` option from the `@nx/jest:jest` executor.",
"implementation": "./src/migrations/update-21-0-0/remove-tsconfig-option-from-jest-executor"
}
},
"packageJsonUpdates": {
Expand Down
11 changes: 7 additions & 4 deletions packages/jest/src/executors/jest/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export interface JestExecutorOptions {
detectLeaks?: boolean;
jestConfig: string;
testFile?: string;
/**
* @deprecated set in the jest config file instead
**/
setupFile?: string;
bail?: boolean | number;
ci?: boolean;
color?: boolean;
Expand Down Expand Up @@ -41,4 +37,11 @@ export interface JestExecutorOptions {
watchAll?: boolean;
testLocationInResults?: boolean;
testTimeout?: number;

/**
* @deprecated Use the `setupFilesAfterEnv` option in the Jest configuration
* file instead. See https://jestjs.io/docs/configuration#setupfilesafterenv-array.
* It will be removed in Nx v22.
*/
setupFile?: string;
}
7 changes: 1 addition & 6 deletions packages/jest/src/executors/jest/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,10 @@
"index": 0
}
},
"tsConfig": {
"description": "The name of the Typescript configuration file.",
"type": "string",
"x-deprecated": "Use the ts-jest configuration options in the jest config file instead."
},
"setupFile": {
"description": "The name of a setup file used by Jest.",
"type": "string",
"x-deprecated": "Use the setupFilesAfterEnv option in the jest config file. https://jestjs.io/docs/en/configuration#setupfilesafterenv-array"
"x-deprecated": "Use the `setupFilesAfterEnv` option in the Jest configuration file instead. See https://jestjs.io/docs/configuration#setupfilesafterenv-array. It will be removed in Nx v22."
},
"bail": {
"alias": "b",
Expand Down
18 changes: 9 additions & 9 deletions packages/jest/src/generators/configuration/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ export interface JestProjectSchema {
project: string;
targetName?: string;
supportTsx?: boolean;
/**
* @deprecated use setupFile instead
*/
skipSetupFile?: boolean;
setupFile?:
| 'angular'
| 'web-components'
Expand All @@ -14,12 +10,7 @@ export interface JestProjectSchema {
| 'none';
skipSerializers?: boolean;
testEnvironment?: 'node' | 'jsdom' | 'none';
/**
* @deprecated use compiler: "babel" instead
*/
babelJest?: boolean;
skipFormat?: boolean;

addPlugin?: boolean;
compiler?: 'tsc' | 'babel' | 'swc';
skipPackageJson?: boolean;
Expand All @@ -30,6 +21,15 @@ export interface JestProjectSchema {
* @internal
*/
addExplicitTargets?: boolean;

/**
* @deprecated Use the `compiler` option instead. It will be removed in Nx v22.
*/
babelJest?: boolean;
/**
* @deprecated Use the `setupFile` option instead. It will be removed in Nx v22.
*/
skipSetupFile?: boolean;
}

export type NormalizedJestProjectSchema = JestProjectSchema & {
Expand Down
4 changes: 2 additions & 2 deletions packages/jest/src/generators/configuration/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"type": "boolean",
"description": "Skips the setup file required for angular.",
"default": false,
"x-deprecated": "Use `--setup-file` instead."
"x-deprecated": "Use the `setupFile` option instead. It will be removed in Nx v22."
},
"setupFile": {
"type": "string",
Expand Down Expand Up @@ -55,7 +55,7 @@
"type": "boolean",
"alias": "babel-jest",
"description": "Use `babel-jest` instead of `ts-jest`.",
"x-deprecated": "Use `--compiler=babel` instead.",
"x-deprecated": "Use the `compiler` option instead. It will be removed in Nx v22.",
"default": false
},
"skipFormat": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#### Remove `tsConfig` Option from Jest Executor

Removes the previously deprecated and unused `tsConfig` option from the `@nx/jest:jest` executor configuration in all projects.

#### Examples

Remove the option from the project configuration:

{% tabs %}
{% tab label="Before" %}

```json {% fileName="apps/myapp/project.json" highlightLines=[7] %}
{
"targets": {
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "apps/myapp/jest.config.ts",
"tsConfig": "apps/myapp/tsconfig.spec.json"
}
}
}
}
```

{% /tab %}

{% tab label="After" %}

```json {% fileName="apps/myapp/project.json" %}
{
"targets": {
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "apps/myapp/jest.config.ts"
}
}
}
}
```

{% /tab %}
{% /tabs %}

Remove the option from a target default using the `@nx/jest:jest` executor:

{% tabs %}
{% tab label="Before" %}

```json {% fileName="nx.json" highlightLines=[7] %}
{
"targetDefaults": {
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "{projectRoot}/jest.config.ts",
"tsConfig": "{projectRoot}/tsconfig.spec.json"
}
}
}
}
```

{% /tab %}

{% tab label="After" %}

```json {% fileName="nx.json" %}
{
"targetDefaults": {
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "{projectRoot}/jest.config.ts"
}
}
}
}
```

{% /tab %}
{% /tabs %}

Remove the option from a target default using the `@nx/jest:jest` executor as the key:

{% tabs %}
{% tab label="Before" %}

```json {% fileName="nx.json" highlightLines=[6] %}
{
"targetDefaults": {
"@nx/jest:jest": {
"options": {
"jestConfig": "{projectRoot}/jest.config.ts",
"tsConfig": "{projectRoot}/tsconfig.spec.json"
}
}
}
}
```

{% /tab %}

{% tab label="After" %}

```json {% fileName="nx.json" %}
{
"targetDefaults": {
"@nx/jest:jest": {
"options": {
"jestConfig": "{projectRoot}/jest.config.ts"
}
}
}
}
```

{% /tab %}
{% /tabs %}
Loading