@nx/detox 24.0.0-beta.2 → 24.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/src/generators/application/application.js +1 -2
  2. package/dist/src/generators/application/lib/add-linting.js +0 -1
  3. package/dist/src/generators/application/lib/add-project.js +1 -39
  4. package/dist/src/generators/application/lib/normalize-options.js +0 -4
  5. package/dist/src/generators/application/schema.d.ts +0 -1
  6. package/dist/src/generators/init/init.js +16 -22
  7. package/dist/src/generators/init/schema.d.ts +0 -1
  8. package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +12 -0
  9. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
  10. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +18 -0
  11. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +89 -0
  12. package/executors.json +1 -12
  13. package/migrations.json +7 -0
  14. package/package.json +8 -8
  15. package/dist/src/executors/build/build.impl.d.ts +0 -7
  16. package/dist/src/executors/build/build.impl.js +0 -60
  17. package/dist/src/executors/build/schema.d.ts +0 -5
  18. package/dist/src/executors/build/schema.json +0 -24
  19. package/dist/src/executors/test/schema.d.ts +0 -39
  20. package/dist/src/executors/test/schema.json +0 -171
  21. package/dist/src/executors/test/test.impl.d.ts +0 -6
  22. package/dist/src/executors/test/test.impl.js +0 -84
  23. package/dist/src/generators/application/lib/get-targets.d.ts +0 -51
  24. package/dist/src/generators/application/lib/get-targets.js +0 -67
  25. package/dist/src/utils/deprecation.d.ts +0 -3
  26. package/dist/src/utils/deprecation.js +0 -21
@@ -17,14 +17,13 @@ const expo_version_utils_1 = require("../../utils/expo-version-utils");
17
17
  const versions_1 = require("../../utils/versions");
18
18
  async function detoxApplicationGenerator(host, schema) {
19
19
  return await detoxApplicationGeneratorInternal(host, {
20
- addPlugin: false,
21
20
  useProjectJson: true,
22
21
  ...schema,
23
22
  });
24
23
  }
25
24
  async function detoxApplicationGeneratorInternal(host, schema) {
26
25
  (0, versions_1.assertSupportedDetoxVersion)(host);
27
- const addTsPlugin = (0, internal_1.shouldConfigureTsSolutionSetup)(host, schema.addPlugin);
26
+ const addTsPlugin = (0, internal_1.shouldConfigureTsSolutionSetup)(host);
28
27
  const jsInitTask = await (0, js_1.initGenerator)(host, {
29
28
  addTsPlugin,
30
29
  skipFormat: true,
@@ -14,7 +14,6 @@ async function addLinting(host, options) {
14
14
  (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'tsconfig.app.json'),
15
15
  ],
16
16
  enableTypedLinting: (0, internal_1.isTypedLintingEnabled)(options),
17
- addPlugin: options.addPlugin,
18
17
  // Detox e2e specs are Jest; this is what enables the linter's Jest rules.
19
18
  unitTestRunner: 'jest',
20
19
  }));
@@ -2,16 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addProject = addProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const get_targets_1 = require("./get-targets");
6
- const deprecation_1 = require("../../../utils/deprecation");
7
5
  function addProject(host, options) {
8
- const nxJson = (0, devkit_1.readNxJson)(host);
9
- const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
10
- ? p === '@nx/detox/plugin'
11
- : p.plugin === '@nx/detox/plugin');
12
- if (!hasPlugin) {
13
- (0, deprecation_1.warnDetoxExecutorsGenerating)();
14
- }
15
6
  const packageJson = {
16
7
  name: options.importPath,
17
8
  version: '0.0.1',
@@ -22,7 +13,6 @@ function addProject(host, options) {
22
13
  name: options.e2eProjectName !== options.importPath
23
14
  ? options.e2eProjectName
24
15
  : undefined,
25
- targets: hasPlugin ? undefined : getTargets(options),
26
16
  implicitDependencies: [options.appProject],
27
17
  };
28
18
  }
@@ -31,7 +21,7 @@ function addProject(host, options) {
31
21
  root: options.e2eProjectRoot,
32
22
  sourceRoot: `${options.e2eProjectRoot}/src`,
33
23
  projectType: 'application',
34
- targets: hasPlugin ? {} : getTargets(options),
24
+ targets: {},
35
25
  tags: [],
36
26
  implicitDependencies: [options.appProject],
37
27
  });
@@ -40,31 +30,3 @@ function addProject(host, options) {
40
30
  (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
41
31
  }
42
32
  }
43
- function getTargets(options) {
44
- const targets = {};
45
- targets['build-ios'] = {
46
- executor: '@nx/detox:build',
47
- ...(options.framework === 'react-native'
48
- ? (0, get_targets_1.reactNativeBuildTarget)('ios.sim')
49
- : (0, get_targets_1.expoBuildTarget)('ios.sim')),
50
- };
51
- targets['test-ios'] = {
52
- executor: '@nx/detox:test',
53
- ...(options.framework === 'react-native'
54
- ? (0, get_targets_1.reactNativeTestTarget)('ios.sim', options.e2eProjectName)
55
- : (0, get_targets_1.expoTestTarget)('ios.sim', options.e2eProjectName)),
56
- };
57
- targets['build-android'] = {
58
- executor: '@nx/detox:build',
59
- ...(options.framework === 'react-native'
60
- ? (0, get_targets_1.reactNativeBuildTarget)('android.emu')
61
- : (0, get_targets_1.expoBuildTarget)('android.emu')),
62
- };
63
- targets['test-android'] = {
64
- executor: '@nx/detox:test',
65
- ...(options.framework === 'react-native'
66
- ? (0, get_targets_1.reactNativeTestTarget)('android.emu', options.e2eProjectName)
67
- : (0, get_targets_1.expoTestTarget)('android.emu', options.e2eProjectName)),
68
- };
69
- return targets;
70
- }
@@ -10,10 +10,6 @@ async function normalizeOptions(host, options) {
10
10
  projectType: 'application',
11
11
  directory: options.e2eDirectory,
12
12
  });
13
- const nxJson = (0, devkit_1.readNxJson)(host);
14
- const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
15
- nxJson.useInferencePlugins !== false;
16
- options.addPlugin ??= addPlugin;
17
13
  const { fileName: appFileName, className: appClassName } = (0, devkit_1.names)(options.appName || options.appProject);
18
14
  const { root: appRoot } = (0, devkit_1.readProjectConfiguration)(host, options.appProject);
19
15
  const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
@@ -15,6 +15,5 @@ export interface Schema {
15
15
  */
16
16
  setParserOptionsProject?: boolean;
17
17
  framework: 'react-native' | 'expo';
18
- addPlugin?: boolean;
19
18
  useProjectJson?: boolean;
20
19
  }
@@ -8,36 +8,30 @@ const devkit_1 = require("@nx/devkit");
8
8
  const plugin_1 = require("../../plugins/plugin");
9
9
  const versions_1 = require("../../utils/versions");
10
10
  function detoxInitGenerator(host, schema) {
11
- return detoxInitGeneratorInternal(host, { addPlugin: false, ...schema });
11
+ return detoxInitGeneratorInternal(host, schema);
12
12
  }
13
13
  async function detoxInitGeneratorInternal(host, schema) {
14
14
  (0, versions_1.assertSupportedDetoxVersion)(host);
15
15
  const tasks = [];
16
- const nxJson = (0, devkit_1.readNxJson)(host);
17
- const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
18
- nxJson.useInferencePlugins !== false;
19
- schema.addPlugin ??= addPluginDefault;
20
16
  if (!schema.skipPackageJson) {
21
17
  tasks.push(moveDependency(host));
22
18
  tasks.push(updateDependencies(host, schema));
23
19
  }
24
- if (schema.addPlugin) {
25
- await (0, internal_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/detox/plugin', plugin_1.createNodesV2, {
26
- buildTargetName: ['build', 'detox:build', 'detox-build'],
27
- startTargetName: ['start', 'detox:start', 'detox-start'],
28
- testTargetName: ['test', 'detox:test', 'detox-test'],
29
- buildDepsTargetName: [
30
- 'build-deps',
31
- 'detox:build-deps',
32
- 'detox-build-deps',
33
- ],
34
- watchDepsTargetName: [
35
- 'watch-deps',
36
- 'detox:watch-deps',
37
- 'detox-watch-deps',
38
- ],
39
- }, schema.updatePackageScripts);
40
- }
20
+ await (0, internal_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/detox/plugin', plugin_1.createNodesV2, {
21
+ buildTargetName: ['build', 'detox:build', 'detox-build'],
22
+ startTargetName: ['start', 'detox:start', 'detox-start'],
23
+ testTargetName: ['test', 'detox:test', 'detox-test'],
24
+ buildDepsTargetName: [
25
+ 'build-deps',
26
+ 'detox:build-deps',
27
+ 'detox-build-deps',
28
+ ],
29
+ watchDepsTargetName: [
30
+ 'watch-deps',
31
+ 'detox:watch-deps',
32
+ 'detox-watch-deps',
33
+ ],
34
+ }, schema.updatePackageScripts);
41
35
  if (!schema.skipFormat) {
42
36
  await (0, devkit_1.formatFiles)(host);
43
37
  }
@@ -3,5 +3,4 @@ export interface Schema {
3
3
  skipPackageJson?: boolean; //default is false
4
4
  keepExistingVersions?: boolean; //default is false
5
5
  updatePackageScripts?: boolean;
6
- addPlugin?: boolean;
7
6
  }
@@ -0,0 +1,12 @@
1
+ # Replace removed @nx/detox executors with inferred tasks
2
+
3
+ Nx 24 removed `@nx/detox:build`, `@nx/detox:test` (including old `@nrwl` aliases).
4
+
5
+ Before changing anything, check for leftover work: a project target, a package.json target or a `targetDefaults` entry still uses a removed executor, or the advisory context reports a conversion error. If none applies, make no changes and stop. Treat each advisory-context item as pending work.
6
+
7
+ 1. Inspect all affected projects and workspace defaults. Repair config-loading errors first. Do not restore executor registrations or install older Nx packages.
8
+ 2. Retain platform-specific build/test entrypoints and Detox configurations. Ensure aliases invoke inferred targets without cycles. Device/simulator validation may be skipped explicitly, but graph creation may not.
9
+ 3. Register `@nx/detox/plugin` with options/includes that preserve custom target names and mixed inferred/explicit projects. Replace remaining removed-executor targets, including those in package.json and filtered targetDefaults. Transfer their behavior before removing obsolete defaults. Preserve configurations, dependencies, cache inputs/outputs and environment behavior. Do not silently delete unsupported options or unrelated targets. Migrate old @nrwl aliases too.
10
+ 4. Run project graph creation with the daemon and graph cache disabled (`NX_DAEMON=false NX_CACHE_PROJECT_GRAPH=false`), using the workspace package manager. Inspect resolved project targets and verify each migrated entrypoint exists and is inferred (a thin alias to an inferred target is acceptable). Resolve graph errors before completing this migration, even if task validation was skipped. Configs must load for subsequent migrations.
11
+ 5. By default run relevant real builds/tests with task cache disabled, including alternate configurations. Honor an existing preference to skip expensive task validation; otherwise offer that option when validation is slow. Skipping expensive tasks never skips conversion or the graph check. Report each skipped task as unverified. Never weaken assertions or change application behavior to make checks pass.
12
+ 6. Report converted projects, graph validation, task results and any skipped checks. Unconverted targets or a broken graph mean the migration is incomplete. Investigate task failures and distinguish missing environment prerequisites from conversion regressions; do not claim a working workspace with unresolved regressions.
@@ -0,0 +1,6 @@
1
+ import type { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<{
3
+ nextSteps?: string[];
4
+ agentContext?: string[];
5
+ skipAgentic?: boolean;
6
+ }>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
4
+ const internal_1 = require("@nx/devkit/internal");
5
+ function update(tree) {
6
+ return (0, internal_1.migrateRemovedExecutors)(tree, [
7
+ '@nx/detox:build',
8
+ '@nx/detox:test',
9
+ '@nrwl/detox:build',
10
+ '@nrwl/detox:test',
11
+ ], async (tree, options) => {
12
+ const { convertToInferred } = require('../../generators/convert-to-inferred/convert-to-inferred');
13
+ // The callback only prints the options the converter could not carry
14
+ // over; migrateRemovedExecutors discards it.
15
+ const flushLogs = await convertToInferred(tree, options);
16
+ flushLogs();
17
+ });
18
+ }
@@ -0,0 +1,89 @@
1
+ #### Convert `@nx/detox` build and test targets to inferred tasks
2
+
3
+ Nx 24 removes the `@nx/detox:build` and `@nx/detox:test` executors and their `@nrwl` aliases. The migration registers `@nx/detox/plugin` in `nx.json` and converts the targets that use those executors to inferred tasks. Each converted target runs the inferred `build` or `test` target and passes its Detox configuration as an argument. A target with nothing left to override is removed from project configuration. When several projects share the same remaining options, those options move to a `targetDefaults` entry scoped to the plugin. `targetDefaults` entries keyed by a removed executor are removed once no target uses that executor.
4
+
5
+ The migration lists the targets the converter cannot convert safely. In agentic runs, an AI prompt finishes them and validates the project graph.
6
+
7
+ #### Sample code changes
8
+
9
+ ##### Before
10
+
11
+ ```json title="apps/demo-e2e/project.json"
12
+ {
13
+ "name": "demo-e2e",
14
+ "targets": {
15
+ "build-android": {
16
+ "executor": "@nx/detox:build",
17
+ "options": {
18
+ "detoxConfiguration": "android.emu.debug"
19
+ },
20
+ "configurations": {
21
+ "production": {
22
+ "detoxConfiguration": "android.emu.release"
23
+ }
24
+ }
25
+ },
26
+ "test-android": {
27
+ "executor": "@nx/detox:test",
28
+ "options": {
29
+ "detoxConfiguration": "android.emu.debug",
30
+ "buildTarget": "demo-e2e:build-android"
31
+ },
32
+ "configurations": {
33
+ "production": {
34
+ "detoxConfiguration": "android.emu.release",
35
+ "buildTarget": "demo-e2e:build-android:production"
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ##### After
44
+
45
+ ```json title="apps/demo-e2e/project.json"
46
+ {
47
+ "name": "demo-e2e",
48
+ "targets": {
49
+ "build-android": {
50
+ "command": "nx run demo-e2e:build",
51
+ "configurations": {
52
+ "production": {
53
+ "args": ["--args=\"-c android.emu.release\""]
54
+ }
55
+ },
56
+ "options": {
57
+ "args": ["--args=\"-c android.emu.debug\""]
58
+ }
59
+ },
60
+ "test-android": {
61
+ "command": "nx run demo-e2e:test",
62
+ "configurations": {
63
+ "production": {
64
+ "args": ["--args=\"-c android.emu.release\""]
65
+ }
66
+ },
67
+ "dependsOn": ["demo-e2e:build-android"],
68
+ "options": {
69
+ "args": ["--args=\"-c android.emu.debug\""]
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ ```json title="nx.json"
77
+ {
78
+ "plugins": [
79
+ {
80
+ "plugin": "@nx/detox/plugin",
81
+ "options": {
82
+ "buildTargetName": "build",
83
+ "startTargetName": "start",
84
+ "testTargetName": "test"
85
+ }
86
+ }
87
+ ]
88
+ }
89
+ ```
package/executors.json CHANGED
@@ -1,14 +1,3 @@
1
1
  {
2
- "executors": {
3
- "build": {
4
- "implementation": "./dist/src/executors/build/build.impl",
5
- "schema": "./dist/src/executors/build/schema.json",
6
- "description": "Run the command defined in build property of the specified configuration."
7
- },
8
- "test": {
9
- "implementation": "./dist/src/executors/test/test.impl",
10
- "schema": "./dist/src/executors/test/schema.json",
11
- "description": "Initiating your detox test suite."
12
- }
13
- }
2
+ "executors": {}
14
3
  }
package/migrations.json CHANGED
@@ -14,6 +14,13 @@
14
14
  "description": "Rename imports of `createNodesV2` from `@nx/detox/plugin` to the canonical `createNodes` export.",
15
15
  "implementation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes",
16
16
  "documentation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md"
17
+ },
18
+ "remove-deprecated-executors": {
19
+ "version": "24.0.0-beta.3",
20
+ "description": "Converts targets using the removed `@nx/detox` executors to inferred tasks; an AI prompt finishes the targets the converter cannot convert safely and validates the project graph.",
21
+ "implementation": "./dist/src/migrations/update-24-0-0/remove-deprecated-executors",
22
+ "prompt": "./dist/src/migrations/update-24-0-0/finish-inferred-conversion.md",
23
+ "documentation": "./dist/src/migrations/update-24-0-0/remove-deprecated-executors.md"
17
24
  }
18
25
  },
19
26
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nx/detox",
3
- "version": "24.0.0-beta.2",
3
+ "version": "24.0.0-beta.4",
4
4
  "private": false,
5
- "description": "The Nx Plugin for Detox contains executors and generators for allowing your workspace to use the powerful Detox integration testing capabilities.",
5
+ "description": "The Nx Plugin for Detox infers tasks and provides generators for allowing your workspace to use the powerful Detox integration testing capabilities.",
6
6
  "keywords": [
7
7
  "Monorepo",
8
8
  "React",
@@ -35,16 +35,16 @@
35
35
  "generators.json"
36
36
  ],
37
37
  "dependencies": {
38
- "@nx/devkit": "24.0.0-beta.2",
39
- "@nx/jest": "24.0.0-beta.2",
40
- "@nx/js": "24.0.0-beta.2",
41
- "@nx/eslint": "24.0.0-beta.2",
42
- "@nx/react": "24.0.0-beta.2",
38
+ "@nx/devkit": "24.0.0-beta.4",
39
+ "@nx/jest": "24.0.0-beta.4",
40
+ "@nx/js": "24.0.0-beta.4",
41
+ "@nx/eslint": "24.0.0-beta.4",
42
+ "@nx/react": "24.0.0-beta.4",
43
43
  "semver": "^7.6.3",
44
44
  "tslib": "^2.3.0"
45
45
  },
46
46
  "devDependencies": {
47
- "nx": "24.0.0-beta.2"
47
+ "nx": "24.0.0-beta.4"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "detox": "^20.0.0"
@@ -1,7 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { DetoxBuildOptions } from './schema';
3
- export interface DetoxBuildOutput {
4
- success: boolean;
5
- }
6
- export default function detoxBuildExecutor(options: DetoxBuildOptions, context: ExecutorContext): AsyncGenerator<DetoxBuildOutput>;
7
- export declare function runCliBuild(workspaceRoot: string, projectRoot: string, options: DetoxBuildOptions): Promise<unknown>;
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = detoxBuildExecutor;
4
- exports.runCliBuild = runCliBuild;
5
- const internal_1 = require("@nx/devkit/internal");
6
- const path_1 = require("path");
7
- const child_process_1 = require("child_process");
8
- const deprecation_1 = require("../../utils/deprecation");
9
- let childProcess;
10
- async function* detoxBuildExecutor(options, context) {
11
- (0, deprecation_1.warnDetoxExecutorsDeprecation)();
12
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
13
- try {
14
- await runCliBuild(context.root, projectRoot, options);
15
- yield { success: true };
16
- }
17
- finally {
18
- if (childProcess) {
19
- childProcess.kill();
20
- }
21
- }
22
- }
23
- function runCliBuild(workspaceRoot, projectRoot, options) {
24
- return new Promise((resolve, reject) => {
25
- childProcess = (0, child_process_1.fork)(require.resolve('detox/local-cli/cli.js'), ['build', ...createDetoxBuildOptions(options)], {
26
- cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
27
- env: process.env,
28
- });
29
- // Ensure the child process is killed when the parent exits
30
- process.on('exit', () => childProcess.kill());
31
- process.on('SIGTERM', () => childProcess.kill());
32
- childProcess.on('error', (err) => {
33
- reject(err);
34
- });
35
- childProcess.on('exit', (code, signal) => {
36
- if (code === null)
37
- code = (0, internal_1.signalToCode)(signal);
38
- if (code === 0) {
39
- resolve(code);
40
- }
41
- else {
42
- reject(code);
43
- }
44
- });
45
- });
46
- }
47
- function createDetoxBuildOptions(options) {
48
- return Object.keys(options).reduce((acc, k) => {
49
- const v = options[k];
50
- if (k === 'detoxConfiguration') {
51
- acc.push('--configuration', v);
52
- }
53
- else if (k === 'configPath') {
54
- acc.push('--config-path', v);
55
- }
56
- else
57
- acc.push(`--${k}`, options[k]);
58
- return acc;
59
- }, []);
60
- }
@@ -1,5 +0,0 @@
1
- // options from https://github.com/wix/Detox/blob/master/docs/cli/build.md
2
- export interface DetoxBuildOptions {
3
- detoxConfiguration?: string;
4
- configPath?: string;
5
- }
@@ -1,24 +0,0 @@
1
- {
2
- "version": 2,
3
- "outputCapture": "direct-nodejs",
4
- "title": "Run detox build",
5
- "description": "Run detox build options.",
6
- "type": "object",
7
- "cli": "nx",
8
- "x-deprecated": "The `@nx/detox:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/detox:convert-to-inferred` to migrate to the `@nx/detox/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
9
- "properties": {
10
- "detoxConfiguration": {
11
- "type": "string",
12
- "description": "Select a device configuration from your defined configurations, if not supplied, and there's only one configuration, detox will default to it.",
13
- "alias": "C"
14
- },
15
- "configPath": {
16
- "type": "string",
17
- "description": "Specify Detox config file path. If not supplied, detox searches for `.detoxrc[.js]` or `detox` section in `package.json`.",
18
- "alias": "cp",
19
- "x-completion-type": "file",
20
- "x-completion-glob": ".detoxrc?(.js)"
21
- }
22
- },
23
- "required": []
24
- }
@@ -1,39 +0,0 @@
1
- export interface DetoxTestOptions {
2
- // options from https://wix.github.io/Detox/docs/cli/test
3
- // detox test args: https://github.com/wix/Detox/blob/master/detox/local-cli/testCommand/builder.js
4
- configPath?: string;
5
- detoxConfiguration: string;
6
- loglevel?: 'fatal' | 'error' | 'warn' | 'info' | 'verbose' | 'trace';
7
- retries?: number;
8
- reuse: boolean; // default is false
9
- cleanup?: boolean;
10
- debugSynchronization?: boolean;
11
- artifactsLocation?: string;
12
- recordLogs?: 'failing' | 'all' | 'none';
13
- takeScreenshots?: 'manual' | 'failing' | 'all' | 'none';
14
- recordVideos?: 'failing' | 'all' | 'none';
15
- recordPerformance?: 'all' | 'none';
16
- captureViewHierarchy?: 'enabled' | 'disabled';
17
- jestReportSpecs?: boolean;
18
- headeless?: boolean;
19
- gpu?: boolean;
20
- keepLockFile?: boolean;
21
- deviceName?: string;
22
- deviceBootArgs?: string;
23
- appLaunchArgs?: string;
24
- useCustomLogger?: boolean;
25
- forceAdbInstall?: boolean;
26
- inspectBrk?: boolean;
27
-
28
- // detox cli options
29
- color?: boolean;
30
-
31
- // nx build options
32
- buildTarget?: string;
33
-
34
- // @deprecated(Emily): removed from Detox 20, remove in next major release
35
- runnerConfig?: string;
36
- recordTimeline?: 'all' | 'none';
37
- workers?: number;
38
- deviceLaunchArgs?: string;
39
- }
@@ -1,171 +0,0 @@
1
- {
2
- "version": 2,
3
- "outputCapture": "direct-nodejs",
4
- "title": "Run detox test",
5
- "description": "Run detox test options.",
6
- "type": "object",
7
- "cli": "nx",
8
- "x-deprecated": "The `@nx/detox:test` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/detox:convert-to-inferred` to migrate to the `@nx/detox/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
9
- "presets": [
10
- {
11
- "name": "Test a Detox Configuration",
12
- "keys": ["detoxConfiguration"]
13
- },
14
- {
15
- "name": "Reuse Existing Installed App",
16
- "keys": ["reuse"]
17
- },
18
- {
19
- "name": "Set Log Level",
20
- "keys": ["loglevel"]
21
- }
22
- ],
23
- "properties": {
24
- "detoxConfiguration": {
25
- "type": "string",
26
- "description": "Select a device configuration from your defined configurations, if not supplied, and there's only one configuration, detox will default to it.",
27
- "alias": "C",
28
- "examples": [
29
- "ios.sim.debug",
30
- "ios.sim.release",
31
- "android.emu.debug",
32
- "android.emu.release"
33
- ]
34
- },
35
- "buildTarget": {
36
- "type": "string",
37
- "description": "Target which builds the application."
38
- },
39
- "configPath": {
40
- "type": "string",
41
- "description": "Specify Detox config file path. If not supplied, detox searches for `.detoxrc[.js]` or `detox` section in package.json.",
42
- "alias": "cp",
43
- "x-completion-type": "file",
44
- "x-completion-glob": ".detoxrc?(.js)",
45
- "x-priority": "important"
46
- },
47
- "loglevel": {
48
- "type": "string",
49
- "enum": ["fatal", "error", "warn", "info", "verbose", "trace"],
50
- "description": "Log level: `fatal`, `error`, `warn`, `info`, `verbose`, `trace`.",
51
- "alias": "l"
52
- },
53
- "retries": {
54
- "type": "number",
55
- "description": "[Jest Circus Only] Re-spawn the test runner for individual failing suite files until they pass, or `<N>` times at least."
56
- },
57
- "reuse": {
58
- "type": "boolean",
59
- "description": "Reuse existing installed app (do not delete + reinstall) for a faster run.",
60
- "default": false
61
- },
62
- "cleanup": {
63
- "type": "boolean",
64
- "description": "Shutdown simulator when test is over, useful for CI scripts, to make sure detox exists cleanly with no residue",
65
- "alias": "u"
66
- },
67
- "debugSynchronization": {
68
- "type": "boolean",
69
- "description": "Customize how long an action/expectation can take to complete before Detox starts querying the app why it is busy. By default, the app status will be printed if the action takes more than 10s to complete.",
70
- "alias": "d"
71
- },
72
- "artifactsLocation": {
73
- "type": "string",
74
- "description": "Artifacts (logs, screenshots, etc) root directory.",
75
- "alias": "a"
76
- },
77
- "recordLogs": {
78
- "type": "string",
79
- "enum": ["failing", "all", "none"],
80
- "description": "Save logs during each test to artifacts directory. Pass `failing` to save logs of failing tests only."
81
- },
82
- "takeScreenshots": {
83
- "type": "string",
84
- "enum": ["manual", "failing", "all", "none"],
85
- "description": "Save screenshots before and after each test to artifacts directory. Pass `failing` to save screenshots of failing tests only. "
86
- },
87
- "recordVideos": {
88
- "type": "string",
89
- "enum": ["failing", "all", "none"],
90
- "description": "Save screen recordings of each test to artifacts directory. Pass `failing` to save recordings of failing tests only."
91
- },
92
- "recordPerformance": {
93
- "type": "string",
94
- "enum": ["all", "none"],
95
- "description": "[iOS Only] Save Detox Instruments performance recordings of each test to artifacts directory."
96
- },
97
- "captureViewHierarchy": {
98
- "type": "string",
99
- "enum": ["enabled", "disabled"],
100
- "description": "[iOS Only] Capture `*.uihierarchy` snapshots on view action errors and `device.captureViewHierarchy()` calls."
101
- },
102
- "jestReportSpecs": {
103
- "type": "boolean",
104
- "description": "[Jest Only] Whether to output logs per each running spec, in real-time. By default, disabled with multiple workers."
105
- },
106
- "headless": {
107
- "type": "boolean",
108
- "description": "Android Only] Launch Emulator in headless mode. Useful when running on CI."
109
- },
110
- "gpu": {
111
- "type": "boolean",
112
- "description": "[Android Only] Launch Emulator with the specific `-gpu [gpu mode]` parameter."
113
- },
114
- "keepLockFile": {
115
- "type": "boolean",
116
- "description": "Keep the device lock file when running Detox tests."
117
- },
118
- "deviceName": {
119
- "type": "string",
120
- "description": "Override the device name specified in a configuration. Useful for running a single build configuration on multiple devices.",
121
- "alias": "n"
122
- },
123
- "deviceBootArgs": {
124
- "type": "string",
125
- "description": "Custom arguments to pass (through) onto the device (emulator/simulator) binary when booted."
126
- },
127
- "appLaunchArgs": {
128
- "type": "number",
129
- "description": "Custom arguments to pass (through) onto the app every time it is launched."
130
- },
131
- "useCustomLogger": {
132
- "type": "boolean",
133
- "description": "Use Detox' custom console-logging implementation, for logging Detox (non-device) logs. Disabling will fallback to Node.js / test-runner's implementation (e.g. Jest / Mocha)."
134
- },
135
- "forceAdbInstall": {
136
- "type": "boolean",
137
- "description": "Due to problems with the adb install command on Android, Detox resorts to a different scheme for install APK's. Setting true will disable that and force usage of `adb install`, instead."
138
- },
139
- "inspectBrk": {
140
- "type": "boolean",
141
- "description": "Uses node's `--inspect-brk` flag to let users debug the jest/mocha test runner"
142
- },
143
- "color": {
144
- "type": "boolean",
145
- "description": "Colors in log output"
146
- },
147
- "runnerConfig": {
148
- "type": "string",
149
- "description": "Test runner config file, defaults to `e2e/mocha.opts` for mocha and `e2e/config.json` for Jest.",
150
- "alias": "o",
151
- "x-deprecated": "Deprecated in Detox 20. It is default to jest.config.json. It could be specified in .detoxrc.json"
152
- },
153
- "recordTimeline": {
154
- "type": "string",
155
- "enum": ["all", "none"],
156
- "description": "[Jest Only] Record tests and events timeline, for visual display on the `chrome://tracing` tool.",
157
- "x-deprecated": "Deprecated in Detox 20."
158
- },
159
- "workers": {
160
- "type": "number",
161
- "description": "Specifies number of workers the test runner should spawn, requires a test runner with parallel execution support (Detox CLI currently supports Jest).",
162
- "x-deprecated": "Deprecated in Detox 20."
163
- },
164
- "deviceLaunchArgs": {
165
- "type": "string",
166
- "description": "A list of passthrough-arguments to use when (if) devices (Android emulator / iOS simulator) are launched by Detox.",
167
- "x-deprecated": "Deprecated in Detox 20. Use `deviceBootArgs` instead."
168
- }
169
- },
170
- "required": ["detoxConfiguration"]
171
- }
@@ -1,6 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { DetoxTestOptions } from './schema';
3
- export interface DetoxTestOutput {
4
- success: boolean;
5
- }
6
- export default function detoxTestExecutor(options: DetoxTestOptions, context: ExecutorContext): AsyncGenerator<DetoxTestOutput>;
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = detoxTestExecutor;
4
- const devkit_1 = require("@nx/devkit");
5
- const internal_1 = require("@nx/devkit/internal");
6
- const path_1 = require("path");
7
- const child_process_1 = require("child_process");
8
- const build_impl_1 = require("../build/build.impl");
9
- const deprecation_1 = require("../../utils/deprecation");
10
- let childProcess;
11
- async function* detoxTestExecutor(options, context) {
12
- (0, deprecation_1.warnDetoxExecutorsDeprecation)();
13
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
14
- try {
15
- if (!options.reuse && options.buildTarget) {
16
- const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
17
- const buildOptions = (0, devkit_1.readTargetOptions)(buildTarget, context);
18
- await (0, build_impl_1.runCliBuild)(context.root, projectRoot, {
19
- ...buildOptions,
20
- detoxConfiguration: options.detoxConfiguration,
21
- });
22
- }
23
- await runCliTest(context.root, projectRoot, options);
24
- yield { success: true };
25
- }
26
- finally {
27
- if (childProcess) {
28
- childProcess.kill();
29
- }
30
- }
31
- }
32
- function runCliTest(workspaceRoot, projectRoot, options) {
33
- return new Promise((resolve, reject) => {
34
- childProcess = (0, child_process_1.fork)(require.resolve('detox/local-cli/cli.js'), ['test', ...createDetoxTestOptions(options)], {
35
- cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
36
- env: process.env,
37
- });
38
- // Ensure the child process is killed when the parent exits
39
- process.on('exit', () => childProcess.kill());
40
- process.on('SIGTERM', () => childProcess.kill());
41
- childProcess.on('error', (err) => {
42
- reject(err);
43
- });
44
- childProcess.on('exit', (code, signal) => {
45
- if (code === null)
46
- code = (0, internal_1.signalToCode)(signal);
47
- if (code === 0) {
48
- resolve(code);
49
- }
50
- else {
51
- reject(code);
52
- }
53
- });
54
- });
55
- }
56
- const nxOptions = ['buildTarget'];
57
- function createDetoxTestOptions(options) {
58
- return Object.keys(options).reduce((acc, k) => {
59
- const propertyValue = options[k];
60
- if (nxOptions.includes(k)) {
61
- return acc;
62
- }
63
- else if (k === 'detoxConfiguration') {
64
- acc.push('--configuration', propertyValue);
65
- }
66
- else if (k === 'deviceBootArgs') {
67
- acc.push(`--device-boot-args="${propertyValue}"`); // the value must be specified after an equal sign (=) and inside quotes: https://wix.github.io/Detox/docs/cli/test
68
- }
69
- else if (k === 'appLaunchArgs') {
70
- acc.push(`--app-launch-args="${propertyValue}"`); // the value must be specified after an equal sign (=) and inside quotes: https://wix.github.io/Detox/docs/cli/test
71
- }
72
- else if (k === 'color') {
73
- // detox only accepts --no-color, not --color
74
- if (!propertyValue) {
75
- acc.push('--no-color');
76
- }
77
- }
78
- else {
79
- const propertyName = (0, devkit_1.names)(k).fileName; // convert camelCase to kebab-case
80
- acc.push(`--${propertyName}`, propertyValue);
81
- }
82
- return acc;
83
- }, []);
84
- }
@@ -1,51 +0,0 @@
1
- export declare function reactNativeBuildTarget(platform: 'ios.sim' | 'android.emu'): {
2
- options: {
3
- detoxConfiguration: string;
4
- };
5
- configurations: {
6
- production: {
7
- detoxConfiguration: string;
8
- };
9
- };
10
- };
11
- export declare function expoBuildTarget(platform: 'ios.sim' | 'android.emu'): {
12
- options: {
13
- detoxConfiguration: string;
14
- };
15
- configurations: {
16
- bare: {
17
- detoxConfiguration: string;
18
- };
19
- production: {
20
- detoxConfiguration: string;
21
- };
22
- };
23
- };
24
- export declare function reactNativeTestTarget(platform: 'ios.sim' | 'android.emu', e2eName: string): {
25
- options: {
26
- detoxConfiguration: string;
27
- buildTarget: string;
28
- };
29
- configurations: {
30
- production: {
31
- detoxConfiguration: string;
32
- buildTarget: string;
33
- };
34
- };
35
- };
36
- export declare function expoTestTarget(platform: 'ios.sim' | 'android.emu', e2eName: string): {
37
- options: {
38
- detoxConfiguration: string;
39
- buildTarget: string;
40
- };
41
- configurations: {
42
- bare: {
43
- detoxConfiguration: string;
44
- buildTarget: string;
45
- };
46
- production: {
47
- detoxConfiguration: string;
48
- buildTarget: string;
49
- };
50
- };
51
- };
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reactNativeBuildTarget = reactNativeBuildTarget;
4
- exports.expoBuildTarget = expoBuildTarget;
5
- exports.reactNativeTestTarget = reactNativeTestTarget;
6
- exports.expoTestTarget = expoTestTarget;
7
- function reactNativeBuildTarget(platform) {
8
- return {
9
- options: {
10
- detoxConfiguration: `${platform}.debug`,
11
- },
12
- configurations: {
13
- production: {
14
- detoxConfiguration: `${platform}.release`,
15
- },
16
- },
17
- };
18
- }
19
- function expoBuildTarget(platform) {
20
- return {
21
- options: {
22
- detoxConfiguration: `${platform}.local`,
23
- },
24
- configurations: {
25
- bare: {
26
- detoxConfiguration: `${platform}.debug`,
27
- },
28
- production: {
29
- detoxConfiguration: `${platform}.release`,
30
- },
31
- },
32
- };
33
- }
34
- function reactNativeTestTarget(platform, e2eName) {
35
- const buildPlatform = platform === 'ios.sim' ? 'ios' : 'android';
36
- return {
37
- options: {
38
- detoxConfiguration: `${platform}.debug`,
39
- buildTarget: `${e2eName}:build-${buildPlatform}`,
40
- },
41
- configurations: {
42
- production: {
43
- detoxConfiguration: `${platform}.release`,
44
- buildTarget: `${e2eName}:build-${buildPlatform}:production`,
45
- },
46
- },
47
- };
48
- }
49
- function expoTestTarget(platform, e2eName) {
50
- const buildPlatform = platform === 'ios.sim' ? 'ios' : 'android';
51
- return {
52
- options: {
53
- detoxConfiguration: `${platform}.local`,
54
- buildTarget: `${e2eName}:build-${buildPlatform}`,
55
- },
56
- configurations: {
57
- bare: {
58
- detoxConfiguration: `${platform}.debug`,
59
- buildTarget: `${e2eName}:build-${buildPlatform}:bare`,
60
- },
61
- production: {
62
- detoxConfiguration: `${platform}.release`,
63
- buildTarget: `${e2eName}:build-${buildPlatform}:production`,
64
- },
65
- },
66
- };
67
- }
@@ -1,3 +0,0 @@
1
- export declare const DETOX_EXECUTORS_DEPRECATION_MESSAGE = "`@nx/detox:build` and `@nx/detox:test` are deprecated and will be removed in Nx v24. Run `nx g @nx/detox:convert-to-inferred` to migrate to the `@nx/detox/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
2
- export declare function warnDetoxExecutorsDeprecation(): void;
3
- export declare function warnDetoxExecutorsGenerating(): void;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DETOX_EXECUTORS_DEPRECATION_MESSAGE = void 0;
4
- exports.warnDetoxExecutorsDeprecation = warnDetoxExecutorsDeprecation;
5
- exports.warnDetoxExecutorsGenerating = warnDetoxExecutorsGenerating;
6
- const devkit_1 = require("@nx/devkit");
7
- // TODO(v24): Remove the @nx/detox:build and @nx/detox:test executors and the
8
- // convert-to-inferred generator. The inferred plugin (@nx/detox/plugin) and
9
- // the application/init generators stay supported.
10
- exports.DETOX_EXECUTORS_DEPRECATION_MESSAGE = '`@nx/detox:build` and `@nx/detox:test` are deprecated and will be removed in Nx v24. Run `nx g @nx/detox:convert-to-inferred` to migrate to the `@nx/detox/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
11
- function warnDetoxExecutorsDeprecation() {
12
- devkit_1.logger.warn(exports.DETOX_EXECUTORS_DEPRECATION_MESSAGE);
13
- }
14
- // Fired when the @nx/detox:application generator is about to generate
15
- // build-ios/test-ios/build-android/test-android targets that use the deprecated
16
- // executors — i.e. when @nx/detox/plugin isn't registered in nx.json. Surfaces
17
- // the deprecation at generation time rather than only when the user later runs
18
- // the generated targets.
19
- function warnDetoxExecutorsGenerating() {
20
- devkit_1.logger.warn('Generating `build-ios`, `test-ios`, `build-android`, and `test-android` targets that use the deprecated `@nx/detox:build` and `@nx/detox:test` executors. These executors will be removed in Nx v24. Run `nx g @nx/detox:convert-to-inferred` next to migrate these targets to the `@nx/detox/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
21
- }