@nx/detox 20.0.0-beta.5 → 20.0.0-beta.7
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.
- package/migrations.json +1 -64
- package/package.json +6 -6
- package/src/generators/application/application.js +2 -0
- package/src/generators/application/lib/normalize-options.js +0 -1
- package/src/generators/application/schema.json +8 -14
- package/src/generators/init/init.js +2 -0
- package/src/migrations/update-16-0-0/update-detoxrc-json.d.ts +0 -10
- package/src/migrations/update-16-0-0/update-detoxrc-json.js +0 -66
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-1-4/update-detoxrc-json-expo.d.ts +0 -8
- package/src/migrations/update-16-1-4/update-detoxrc-json-expo.js +0 -81
package/migrations.json
CHANGED
|
@@ -1,69 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
3
|
-
"update-16-0-0-add-nx-packages": {
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"version": "16.0.0-beta.1",
|
|
6
|
-
"description": "Replace @nrwl/detox with @nx/detox",
|
|
7
|
-
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
|
8
|
-
},
|
|
9
|
-
"update-16-0-0-update-detoxrc": {
|
|
10
|
-
"cli": "nx",
|
|
11
|
-
"version": "16.0.0-beta.3",
|
|
12
|
-
"description": "Update .detoxrc.json and jest.config.json for detox 20",
|
|
13
|
-
"implementation": "./src/migrations/update-16-0-0/update-detoxrc-json"
|
|
14
|
-
},
|
|
15
|
-
"update-detoxrc-json-expo-16-1-4": {
|
|
16
|
-
"cli": "nx",
|
|
17
|
-
"version": "16.1.4-beta.0",
|
|
18
|
-
"description": "Update .detoxrc.json for expo",
|
|
19
|
-
"implementation": "./src/migrations/update-16-1-4/update-detoxrc-json-expo"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
2
|
+
"generators": {},
|
|
22
3
|
"packageJsonUpdates": {
|
|
23
|
-
"16.0.0": {
|
|
24
|
-
"version": "16.0.0-beta.3",
|
|
25
|
-
"packages": {
|
|
26
|
-
"detox": {
|
|
27
|
-
"version": "~20.7.0",
|
|
28
|
-
"alwaysAddToPackageJson": false
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"16.1.1": {
|
|
33
|
-
"version": "16.1.1-beta.0",
|
|
34
|
-
"packages": {
|
|
35
|
-
"detox": {
|
|
36
|
-
"version": "~20.8.0",
|
|
37
|
-
"alwaysAddToPackageJson": false
|
|
38
|
-
},
|
|
39
|
-
"@config-plugins/detox": {
|
|
40
|
-
"version": "~5.0.1",
|
|
41
|
-
"alwaysAddToPackageJson": false
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"16.1.5": {
|
|
46
|
-
"version": "16.1.5-beta.0",
|
|
47
|
-
"packages": {
|
|
48
|
-
"detox": {
|
|
49
|
-
"version": "^20.9.0",
|
|
50
|
-
"alwaysAddToPackageJson": false
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"16.6.0": {
|
|
55
|
-
"version": "16.6.0-beta.6",
|
|
56
|
-
"packages": {
|
|
57
|
-
"detox": {
|
|
58
|
-
"version": "^20.11.1",
|
|
59
|
-
"alwaysAddToPackageJson": false
|
|
60
|
-
},
|
|
61
|
-
"@config-plugins/detox": {
|
|
62
|
-
"version": "~6.0.0",
|
|
63
|
-
"alwaysAddToPackageJson": false
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
4
|
"18.0.0": {
|
|
68
5
|
"version": "18.0.0-beta.0",
|
|
69
6
|
"packages": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/detox",
|
|
3
|
-
"version": "20.0.0-beta.
|
|
3
|
+
"version": "20.0.0-beta.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Detox contains executors and generators for allowing your workspace to use the powerful Detox integration testing capabilities.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"main": "./index",
|
|
28
28
|
"types": "index.d.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@nx/devkit": "20.0.0-beta.
|
|
31
|
-
"@nx/jest": "20.0.0-beta.
|
|
32
|
-
"@nx/js": "20.0.0-beta.
|
|
33
|
-
"@nx/eslint": "20.0.0-beta.
|
|
34
|
-
"@nx/react": "20.0.0-beta.
|
|
30
|
+
"@nx/devkit": "20.0.0-beta.7",
|
|
31
|
+
"@nx/jest": "20.0.0-beta.7",
|
|
32
|
+
"@nx/js": "20.0.0-beta.7",
|
|
33
|
+
"@nx/eslint": "20.0.0-beta.7",
|
|
34
|
+
"@nx/react": "20.0.0-beta.7",
|
|
35
35
|
"tslib": "^2.3.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.detoxApplicationGenerator = detoxApplicationGenerator;
|
|
4
4
|
exports.detoxApplicationGeneratorInternal = detoxApplicationGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
6
7
|
const init_1 = require("../init/init");
|
|
7
8
|
const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
|
|
8
9
|
const add_linting_1 = require("./lib/add-linting");
|
|
@@ -17,6 +18,7 @@ async function detoxApplicationGenerator(host, schema) {
|
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
async function detoxApplicationGeneratorInternal(host, schema) {
|
|
21
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'detox', 'application');
|
|
20
22
|
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
21
23
|
const initTask = await (0, init_1.default)(host, {
|
|
22
24
|
...options,
|
|
@@ -8,7 +8,6 @@ async function normalizeOptions(host, options) {
|
|
|
8
8
|
name: options.e2eName,
|
|
9
9
|
projectType: 'application',
|
|
10
10
|
directory: options.e2eDirectory,
|
|
11
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
12
11
|
});
|
|
13
12
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
14
13
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -12,15 +12,18 @@
|
|
|
12
12
|
},
|
|
13
13
|
"x-prompt": "What is the name of the frontend project to test?"
|
|
14
14
|
},
|
|
15
|
-
"
|
|
15
|
+
"e2eDirectory": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "A directory where the project is placed relative current working directory (CWD).",
|
|
18
18
|
"$default": {
|
|
19
19
|
"$source": "argv",
|
|
20
20
|
"index": 0
|
|
21
21
|
},
|
|
22
|
-
"x-prompt": "
|
|
23
|
-
|
|
22
|
+
"x-prompt": "Which directory do you want to create the E2E project in?"
|
|
23
|
+
},
|
|
24
|
+
"e2eName": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Name of the E2E Project."
|
|
24
27
|
},
|
|
25
28
|
"appName": {
|
|
26
29
|
"type": "string",
|
|
@@ -36,15 +39,6 @@
|
|
|
36
39
|
"enum": ["react-native", "expo"],
|
|
37
40
|
"x-prompt": "What app framework should detox test?"
|
|
38
41
|
},
|
|
39
|
-
"e2eDirectory": {
|
|
40
|
-
"type": "string",
|
|
41
|
-
"description": "A directory where the project is placed relative to apps directory."
|
|
42
|
-
},
|
|
43
|
-
"projectNameAndRootFormat": {
|
|
44
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
45
|
-
"type": "string",
|
|
46
|
-
"enum": ["as-provided", "derived"]
|
|
47
|
-
},
|
|
48
42
|
"linter": {
|
|
49
43
|
"description": "The tool to use for running lint checks.",
|
|
50
44
|
"type": "string",
|
|
@@ -68,5 +62,5 @@
|
|
|
68
62
|
"default": false
|
|
69
63
|
}
|
|
70
64
|
},
|
|
71
|
-
"required": ["
|
|
65
|
+
"required": ["e2eDirectory", "appProject", "framework"]
|
|
72
66
|
}
|
|
@@ -5,12 +5,14 @@ exports.detoxInitGeneratorInternal = detoxInitGeneratorInternal;
|
|
|
5
5
|
exports.updateDependencies = updateDependencies;
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
8
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
9
|
const plugin_1 = require("../../plugins/plugin");
|
|
9
10
|
const versions_1 = require("../../utils/versions");
|
|
10
11
|
function detoxInitGenerator(host, schema) {
|
|
11
12
|
return detoxInitGeneratorInternal(host, { addPlugin: false, ...schema });
|
|
12
13
|
}
|
|
13
14
|
async function detoxInitGeneratorInternal(host, schema) {
|
|
15
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'detox', 'init');
|
|
14
16
|
const tasks = [];
|
|
15
17
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
16
18
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
|
-
/**
|
|
3
|
-
* Update .detoxrc.json under detox project:
|
|
4
|
-
* - remove deprecated keys: testRunner
|
|
5
|
-
* - update keys: runnerConfig
|
|
6
|
-
* Update jest.config.json under detox project:
|
|
7
|
-
* - remove key: transform
|
|
8
|
-
* - add key: rootDir, testMatch, reporter, globalSetup, globalTeardown, verbose
|
|
9
|
-
*/
|
|
10
|
-
export default function update(tree: Tree): Promise<void>;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
/**
|
|
6
|
-
* Update .detoxrc.json under detox project:
|
|
7
|
-
* - remove deprecated keys: testRunner
|
|
8
|
-
* - update keys: runnerConfig
|
|
9
|
-
* Update jest.config.json under detox project:
|
|
10
|
-
* - remove key: transform
|
|
11
|
-
* - add key: rootDir, testMatch, reporter, globalSetup, globalTeardown, verbose
|
|
12
|
-
*/
|
|
13
|
-
async function update(tree) {
|
|
14
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
15
|
-
projects.forEach((project) => {
|
|
16
|
-
if (project.targets?.['test-ios']?.executor !== '@nx/detox:test')
|
|
17
|
-
return;
|
|
18
|
-
updateDetoxrcJson(tree, project);
|
|
19
|
-
updateJestConfigJson(tree, project);
|
|
20
|
-
});
|
|
21
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
22
|
-
}
|
|
23
|
-
function updateDetoxrcJson(host, project) {
|
|
24
|
-
const detoxConfigPath = `${project.root}/.detoxrc.json`;
|
|
25
|
-
if (!host.exists(detoxConfigPath))
|
|
26
|
-
return;
|
|
27
|
-
(0, devkit_1.updateJson)(host, detoxConfigPath, (json) => {
|
|
28
|
-
json.testRunner = {
|
|
29
|
-
args: {
|
|
30
|
-
$0: 'jest',
|
|
31
|
-
config: './jest.config.json',
|
|
32
|
-
},
|
|
33
|
-
jest: {
|
|
34
|
-
setupTimeout: 120000,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
if (json.runnerConfig) {
|
|
38
|
-
delete json.runnerConfig;
|
|
39
|
-
}
|
|
40
|
-
return json;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function updateJestConfigJson(host, project) {
|
|
44
|
-
const jestConfigPath = `${project.root}/jest.config.json`;
|
|
45
|
-
if (!host.exists(jestConfigPath))
|
|
46
|
-
return;
|
|
47
|
-
(0, devkit_1.updateJson)(host, jestConfigPath, (json) => {
|
|
48
|
-
if (json.transform) {
|
|
49
|
-
delete json.transform;
|
|
50
|
-
}
|
|
51
|
-
if (!json.rootDir) {
|
|
52
|
-
json.rootDir = '.';
|
|
53
|
-
}
|
|
54
|
-
if (!json.testMatch) {
|
|
55
|
-
json.testMatch = [
|
|
56
|
-
'<rootDir>/src/**/*.test.ts?(x)',
|
|
57
|
-
'<rootDir>/src/**/*.spec.ts?(x)',
|
|
58
|
-
];
|
|
59
|
-
}
|
|
60
|
-
json.reporter = ['detox/runners/jest/reporter'];
|
|
61
|
-
json.globalSetup = 'detox/runners/jest/globalSetup';
|
|
62
|
-
json.globalTeardown = 'detox/runners/jest/globalTeardown';
|
|
63
|
-
json.verbose = true;
|
|
64
|
-
return json;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = replacePackage;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
6
|
-
async function replacePackage(tree) {
|
|
7
|
-
(0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/detox', '@nx/detox');
|
|
8
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
9
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
/**
|
|
6
|
-
* Update .detoxrc.json under detox project for expo:
|
|
7
|
-
* - fix the eas build command
|
|
8
|
-
* - fix the local build command
|
|
9
|
-
* - update project.json targets
|
|
10
|
-
*/
|
|
11
|
-
async function update(tree) {
|
|
12
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
13
|
-
projects.forEach((project) => {
|
|
14
|
-
if (project.targets?.['test-ios']?.executor !== '@nx/detox:test')
|
|
15
|
-
return;
|
|
16
|
-
updateDetoxrcJson(tree, project);
|
|
17
|
-
updateProjectJson(tree, project);
|
|
18
|
-
});
|
|
19
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
20
|
-
}
|
|
21
|
-
function updateDetoxrcJson(host, project) {
|
|
22
|
-
const detoxConfigPath = `${project.root}/.detoxrc.json`;
|
|
23
|
-
const projectName = project.name?.endsWith('-e2e')
|
|
24
|
-
? project.name.substring(0, project.name.indexOf('-e2e'))
|
|
25
|
-
: project.name;
|
|
26
|
-
const appRoot = (0, devkit_1.getProjects)(host).get(projectName)?.root;
|
|
27
|
-
const appName = (0, devkit_1.names)(projectName).className;
|
|
28
|
-
const offset = (0, devkit_1.offsetFromRoot)(project.root);
|
|
29
|
-
const exec = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(host.root)).exec;
|
|
30
|
-
if (!host.exists(detoxConfigPath))
|
|
31
|
-
return;
|
|
32
|
-
(0, devkit_1.updateJson)(host, detoxConfigPath, (json) => {
|
|
33
|
-
if (json.apps?.['ios.eas']) {
|
|
34
|
-
json.apps['ios.eas'].build = `${exec} nx run ${projectName}:download --platform ios --distribution simulator --output=${offset}${appRoot}/dist/`;
|
|
35
|
-
}
|
|
36
|
-
if (json.apps?.['android.eas']) {
|
|
37
|
-
json.apps['android.eas'].build = `${exec} nx run ${projectName}:download --platform android --distribution simulator --output=${offset}${appRoot}/dist/`;
|
|
38
|
-
json.apps['android.eas'].type = 'android.apk';
|
|
39
|
-
}
|
|
40
|
-
if (json.apps?.['ios.local']) {
|
|
41
|
-
json.apps['ios.local'].build = `${exec} nx run ${projectName}:build --platform ios --profile preview --wait --local --no-interactive --output=${offset}${appRoot}/dist/${appName}.tar.gz`;
|
|
42
|
-
}
|
|
43
|
-
if (json.apps?.['android.local']) {
|
|
44
|
-
json.apps['android.local'].build = `${exec} nx run ${projectName}:build --platform android --profile preview --wait --local --no-interactive --output=${offset}${appRoot}/dist/${appName}.apk`;
|
|
45
|
-
json.apps['android.local'].type = 'android.apk';
|
|
46
|
-
}
|
|
47
|
-
return json;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function updateProjectJson(host, project) {
|
|
51
|
-
if (project.targets?.['test-ios']?.options?.detoxConfiguration == 'ios.sim.eas') {
|
|
52
|
-
project.targets['build-ios'].options.detoxConfiguration = 'ios.sim.eas';
|
|
53
|
-
}
|
|
54
|
-
if (project.targets?.['test-android']?.options?.detoxConfiguration ==
|
|
55
|
-
'android.sim.eas') {
|
|
56
|
-
project.targets['build-android'].options.detoxConfiguration =
|
|
57
|
-
'android.sim.eas';
|
|
58
|
-
project.targets['test-android'] = {
|
|
59
|
-
executor: '@nx/detox:test',
|
|
60
|
-
options: {
|
|
61
|
-
detoxConfiguration: 'android.sim.eas',
|
|
62
|
-
buildTarget: `${project.name}:build-android`,
|
|
63
|
-
},
|
|
64
|
-
configurations: {
|
|
65
|
-
local: {
|
|
66
|
-
detoxConfiguration: 'android.emu.local',
|
|
67
|
-
buildTarget: `${project.name}:build-android:local`,
|
|
68
|
-
},
|
|
69
|
-
bare: {
|
|
70
|
-
detoxConfiguration: 'android.emu.debug',
|
|
71
|
-
buildTarget: `${project.name}:build-android:bare`,
|
|
72
|
-
},
|
|
73
|
-
production: {
|
|
74
|
-
detoxConfiguration: 'android.emu.release',
|
|
75
|
-
buildTarget: `${project.name}:build-android:production`,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
(0, devkit_1.updateProjectConfiguration)(host, project.name, project);
|
|
81
|
-
}
|