@nx/detox 16.0.0-beta.1

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 (74) hide show
  1. package/.eslintrc.json +19 -0
  2. package/CHANGELOG.md +8 -0
  3. package/LICENSE +22 -0
  4. package/README.md +63 -0
  5. package/executors.json +14 -0
  6. package/generators.json +35 -0
  7. package/index.d.ts +2 -0
  8. package/index.js +8 -0
  9. package/index.js.map +1 -0
  10. package/migrations.json +212 -0
  11. package/package.json +48 -0
  12. package/project.json +58 -0
  13. package/src/executors/build/build.impl.d.ts +7 -0
  14. package/src/executors/build/build.impl.js +59 -0
  15. package/src/executors/build/build.impl.js.map +1 -0
  16. package/src/executors/build/compat.d.ts +2 -0
  17. package/src/executors/build/compat.js +6 -0
  18. package/src/executors/build/compat.js.map +1 -0
  19. package/src/executors/build/schema.json +23 -0
  20. package/src/executors/test/compat.d.ts +2 -0
  21. package/src/executors/test/compat.js +6 -0
  22. package/src/executors/test/compat.js.map +1 -0
  23. package/src/executors/test/schema.json +149 -0
  24. package/src/executors/test/test.impl.d.ts +6 -0
  25. package/src/executors/test/test.impl.js +74 -0
  26. package/src/executors/test/test.impl.js.map +1 -0
  27. package/src/generators/application/application.d.ts +5 -0
  28. package/src/generators/application/application.js +29 -0
  29. package/src/generators/application/application.js.map +1 -0
  30. package/src/generators/application/files/app/.babelrc.template +11 -0
  31. package/src/generators/application/files/app/.detoxrc.json.template +102 -0
  32. package/src/generators/application/files/app/jest.config.json.template +15 -0
  33. package/src/generators/application/files/app/src/app.spec.ts.template +11 -0
  34. package/src/generators/application/files/app/test-setup.ts.template +5 -0
  35. package/src/generators/application/files/app/tsconfig.e2e.json +10 -0
  36. package/src/generators/application/files/app/tsconfig.json +10 -0
  37. package/src/generators/application/lib/add-git-ignore-entry.d.ts +3 -0
  38. package/src/generators/application/lib/add-git-ignore-entry.js +16 -0
  39. package/src/generators/application/lib/add-git-ignore-entry.js.map +1 -0
  40. package/src/generators/application/lib/add-linting.d.ts +3 -0
  41. package/src/generators/application/lib/add-linting.js +28 -0
  42. package/src/generators/application/lib/add-linting.js.map +1 -0
  43. package/src/generators/application/lib/add-project.d.ts +3 -0
  44. package/src/generators/application/lib/add-project.js +33 -0
  45. package/src/generators/application/lib/add-project.js.map +1 -0
  46. package/src/generators/application/lib/create-files.d.ts +3 -0
  47. package/src/generators/application/lib/create-files.js +14 -0
  48. package/src/generators/application/lib/create-files.js.map +1 -0
  49. package/src/generators/application/lib/get-targets.d.ts +58 -0
  50. package/src/generators/application/lib/get-targets.js +76 -0
  51. package/src/generators/application/lib/get-targets.js.map +1 -0
  52. package/src/generators/application/lib/normalize-options.d.ts +18 -0
  53. package/src/generators/application/lib/normalize-options.js +34 -0
  54. package/src/generators/application/lib/normalize-options.js.map +1 -0
  55. package/src/generators/application/schema.json +66 -0
  56. package/src/generators/init/init.d.ts +6 -0
  57. package/src/generators/init/init.js +37 -0
  58. package/src/generators/init/init.js.map +1 -0
  59. package/src/generators/init/schema.json +21 -0
  60. package/src/migrations/update-13-10-3/add-verbose-jest-config-13-10-3.d.ts +5 -0
  61. package/src/migrations/update-13-10-3/add-verbose-jest-config-13-10-3.js +32 -0
  62. package/src/migrations/update-13-10-3/add-verbose-jest-config-13-10-3.js.map +1 -0
  63. package/src/migrations/update-13-5-0/add-build-target-test-13-5-0.d.ts +5 -0
  64. package/src/migrations/update-13-5-0/add-build-target-test-13-5-0.js +27 -0
  65. package/src/migrations/update-13-5-0/add-build-target-test-13-5-0.js.map +1 -0
  66. package/src/migrations/update-13-8-2/remove-types-detox-13-8-2.d.ts +2 -0
  67. package/src/migrations/update-13-8-2/remove-types-detox-13-8-2.js +25 -0
  68. package/src/migrations/update-13-8-2/remove-types-detox-13-8-2.js.map +1 -0
  69. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  70. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  71. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  72. package/src/utils/versions.d.ts +3 -0
  73. package/src/utils/versions.js +7 -0
  74. package/src/utils/versions.js.map +1 -0
@@ -0,0 +1,149 @@
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
+ "presets": [
9
+ {
10
+ "name": "Run tests",
11
+ "keys": ["detoxConfiguration", "loglevel", "reuse"]
12
+ }
13
+ ],
14
+ "properties": {
15
+ "detoxConfiguration": {
16
+ "type": "string",
17
+ "description": "Select a device configuration from your defined configurations, if not supplied, and there's only one configuration, detox will default to it.",
18
+ "alias": "C",
19
+ "examples": [
20
+ "ios.sim.debug",
21
+ "ios.sim.release",
22
+ "android.emu.debug",
23
+ "android.emu.release"
24
+ ]
25
+ },
26
+ "buildTarget": {
27
+ "type": "string",
28
+ "description": "Target which builds the application."
29
+ },
30
+ "configPath": {
31
+ "type": "string",
32
+ "description": "Specify Detox config file path. If not supplied, detox searches for `.detoxrc[.js]` or `detox` section in package.json.",
33
+ "alias": "cp",
34
+ "x-completion-type": "file",
35
+ "x-completion-glob": ".detoxrc?(.js)",
36
+ "x-priority": "important"
37
+ },
38
+ "runnerConfig": {
39
+ "type": "string",
40
+ "description": "Test runner config file, defaults to `e2e/mocha.opts` for mocha and `e2e/config.json` for Jest.",
41
+ "alias": "o"
42
+ },
43
+ "deviceName": {
44
+ "type": "string",
45
+ "description": "Override the device name specified in a configuration. Useful for running a single build configuration on multiple devices.",
46
+ "alias": "n"
47
+ },
48
+ "loglevel": {
49
+ "type": "string",
50
+ "enum": ["fatal", "error", "warn", "info", "verbose", "trace"],
51
+ "description": "Log level: `fatal`, `error`, `warn`, `info`, `verbose`, `trace`.",
52
+ "alias": "l"
53
+ },
54
+ "debugSynchronization": {
55
+ "type": "boolean",
56
+ "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.",
57
+ "alias": "d"
58
+ },
59
+ "artifactsLocation": {
60
+ "type": "string",
61
+ "description": "Artifacts (logs, screenshots, etc) root directory.",
62
+ "alias": "a"
63
+ },
64
+ "recordLogs": {
65
+ "type": "string",
66
+ "enum": ["failing", "all", "none"],
67
+ "description": "Save logs during each test to artifacts directory. Pass `failing` to save logs of failing tests only."
68
+ },
69
+ "takeScreenshots": {
70
+ "type": "string",
71
+ "enum": ["manual", "failing", "all", "none"],
72
+ "description": "Save screenshots before and after each test to artifacts directory. Pass `failing` to save screenshots of failing tests only. "
73
+ },
74
+ "recordVideos": {
75
+ "type": "string",
76
+ "enum": ["failing", "all", "none"],
77
+ "description": "Save screen recordings of each test to artifacts directory. Pass `failing` to save recordings of failing tests only."
78
+ },
79
+ "recordPerformance": {
80
+ "type": "string",
81
+ "enum": ["all", "none"],
82
+ "description": "[iOS Only] Save Detox Instruments performance recordings of each test to artifacts directory."
83
+ },
84
+ "recordTimeline": {
85
+ "type": "string",
86
+ "enum": ["all", "none"],
87
+ "description": "[Jest Only] Record tests and events timeline, for visual display on the `chrome://tracing` tool."
88
+ },
89
+ "captureViewHierarchy": {
90
+ "type": "string",
91
+ "enum": ["enabled", "disabled"],
92
+ "description": "[iOS Only] Capture `*.uihierarchy` snapshots on view action errors and `device.captureViewHierarchy()` calls."
93
+ },
94
+ "retries": {
95
+ "type": "number",
96
+ "description": "[Jest Circus Only] Re-spawn the test runner for individual failing suite files until they pass, or `<N>` times at least."
97
+ },
98
+ "reuse": {
99
+ "type": "boolean",
100
+ "description": "Reuse existing installed app (do not delete + reinstall) for a faster run.",
101
+ "default": true
102
+ },
103
+ "cleanup": {
104
+ "type": "boolean",
105
+ "description": "Shutdown simulator when test is over, useful for CI scripts, to make sure detox exists cleanly with no residue"
106
+ },
107
+ "workers": {
108
+ "type": "number",
109
+ "description": "Specifies number of workers the test runner should spawn, requires a test runner with parallel execution support (Detox CLI currently supports Jest)."
110
+ },
111
+ "jestReportSpecs": {
112
+ "type": "boolean",
113
+ "description": "[Jest Only] Whether to output logs per each running spec, in real-time. By default, disabled with multiple workers."
114
+ },
115
+ "headless": {
116
+ "type": "boolean",
117
+ "description": "Android Only] Launch Emulator in headless mode. Useful when running on CI."
118
+ },
119
+ "gpu": {
120
+ "type": "boolean",
121
+ "description": "[Android Only] Launch Emulator with the specific `-gpu [gpu mode]` parameter."
122
+ },
123
+ "deviceLaunchArgs": {
124
+ "type": "string",
125
+ "description": "A list of passthrough-arguments to use when (if) devices (Android emulator / iOS simulator) are launched by Detox."
126
+ },
127
+ "appLaunchArgs": {
128
+ "type": "number",
129
+ "description": "Custom arguments to pass (through) onto the app every time it is launched."
130
+ },
131
+ "noColor": {
132
+ "type": "boolean",
133
+ "description": "Disable colors in log output"
134
+ },
135
+ "useCustomLogger": {
136
+ "type": "boolean",
137
+ "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)."
138
+ },
139
+ "forceAdbInstall": {
140
+ "type": "boolean",
141
+ "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."
142
+ },
143
+ "inspectBrk": {
144
+ "type": "boolean",
145
+ "description": "Uses node's `--inspect-brk` flag to let users debug the jest/mocha test runner"
146
+ }
147
+ },
148
+ "required": ["detoxConfiguration"]
149
+ }
@@ -0,0 +1,6 @@
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>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const devkit_2 = require("@nx/devkit");
6
+ const path_1 = require("path");
7
+ const child_process_1 = require("child_process");
8
+ const build_impl_1 = require("../build/build.impl");
9
+ let childProcess;
10
+ function detoxTestExecutor(options, context) {
11
+ return tslib_1.__asyncGenerator(this, arguments, function* detoxTestExecutor_1() {
12
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
13
+ try {
14
+ if (options.buildTarget) {
15
+ const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph);
16
+ const buildOptions = (0, devkit_1.readTargetOptions)(buildTarget, context);
17
+ yield tslib_1.__await((0, build_impl_1.runCliBuild)(context.root, projectRoot, Object.assign(Object.assign({}, buildOptions), { detoxConfiguration: options.detoxConfiguration })));
18
+ }
19
+ yield tslib_1.__await(runCliTest(context.root, projectRoot, options));
20
+ yield yield tslib_1.__await({ success: true });
21
+ }
22
+ finally {
23
+ if (childProcess) {
24
+ childProcess.kill();
25
+ }
26
+ }
27
+ });
28
+ }
29
+ exports.default = detoxTestExecutor;
30
+ function runCliTest(workspaceRoot, projectRoot, options) {
31
+ return new Promise((resolve, reject) => {
32
+ childProcess = (0, child_process_1.fork)((0, path_1.join)(workspaceRoot, './node_modules/detox/local-cli/cli.js'), ['test', ...createDetoxTestOptions(options)], {
33
+ cwd: (0, path_1.join)(workspaceRoot, projectRoot),
34
+ });
35
+ // Ensure the child process is killed when the parent exits
36
+ process.on('exit', () => childProcess.kill());
37
+ process.on('SIGTERM', () => childProcess.kill());
38
+ childProcess.on('error', (err) => {
39
+ reject(err);
40
+ });
41
+ childProcess.on('exit', (code) => {
42
+ if (code === 0) {
43
+ resolve(code);
44
+ }
45
+ else {
46
+ reject(code);
47
+ }
48
+ });
49
+ });
50
+ }
51
+ const nxOptions = ['buildTarget'];
52
+ function createDetoxTestOptions(options) {
53
+ return Object.keys(options).reduce((acc, k) => {
54
+ const propertyValue = options[k];
55
+ if (nxOptions.includes(k)) {
56
+ return acc;
57
+ }
58
+ else if (k === 'detoxConfiguration') {
59
+ acc.push('--configuration', propertyValue);
60
+ }
61
+ else if (k === 'deviceLaunchArgs') {
62
+ acc.push(`--device-launch-args="${propertyValue}"`); // the value must be specified after an equal sign (=) and inside quotes.
63
+ }
64
+ else if (k === 'appLaunchArgs') {
65
+ acc.push(`--app-launch-argss="${propertyValue}"`); // the value must be specified after an equal sign (=) and inside quotes.
66
+ }
67
+ else {
68
+ const propertyName = (0, devkit_2.names)(k).fileName; // convert camelCase to kebab-case
69
+ acc.push(`--${propertyName}`, propertyValue);
70
+ }
71
+ return acc;
72
+ }, []);
73
+ }
74
+ //# sourceMappingURL=test.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.impl.js","sourceRoot":"","sources":["../../../../../../packages/detox/src/executors/test/test.impl.ts"],"names":[],"mappings":";;;AAAA,uCAIoB;AACpB,uCAAmC;AACnC,+BAA4B;AAC5B,iDAAmD;AAGnD,oDAAkD;AAQlD,IAAI,YAA0B,CAAC;AAE/B,SAA+B,iBAAiB,CAC9C,OAAyB,EACzB,OAAwB;;QAExB,MAAM,WAAW,GACf,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;QAEpE,IAAI;YACF,IAAI,OAAO,CAAC,WAAW,EAAE;gBACvB,MAAM,WAAW,GAAG,IAAA,0BAAiB,EACnC,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,YAAY,CACrB,CAAC;gBACF,MAAM,YAAY,GAAG,IAAA,0BAAiB,EACpC,WAAW,EACX,OAAO,CACR,CAAC;gBAEF,sBAAM,IAAA,wBAAW,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,kCACtC,YAAY,KACf,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAC9C,CAAA,CAAC;aACJ;YAED,sBAAM,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA,CAAC;YAErD,4BAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA,CAAC;SACzB;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AC5C,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;YACzB,OAAO,GAAG,CAAC;SACZ;aAAM,IAAI,CAAC,KAAK,oBAAoB,EAAE;YACrC,GAAG,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;SAC5C;aAAM,IAAI,CAAC,KAAK,kBAAkB,EAAE;YACnC,GAAG,CAAC,IAAI,CAAC,yBAAyB,aAAa,GAAG,CAAC,CAAC,CAAC,yEAAyE;SAC/H;aAAM,IAAI,CAAC,KAAK,eAAe,EAAE;YAChC,GAAG,CAAC,IAAI,CAAC,uBAAuB,aAAa,GAAG,CAAC,CAAC,CAAC,yEAAyE;SAC7H;aAAM;YACL,MAAM,YAAY,GAAG,IAAA,cAAK,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,kCAAkC;YAC1E,GAAG,CAAC,IAAI,CAAC,KAAK,YAAY,EAAE,EAAE,aAAa,CAAC,CAAC;SAC9C;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { Schema } from './schema';
3
+ export declare function detoxApplicationGenerator(host: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
4
+ export default detoxApplicationGenerator;
5
+ export declare const detoxApplicationSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detoxApplicationSchematic = exports.detoxApplicationGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const init_1 = require("../init/init");
7
+ const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
8
+ const add_linting_1 = require("./lib/add-linting");
9
+ const add_project_1 = require("./lib/add-project");
10
+ const create_files_1 = require("./lib/create-files");
11
+ const normalize_options_1 = require("./lib/normalize-options");
12
+ function detoxApplicationGenerator(host, schema) {
13
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+ const options = (0, normalize_options_1.normalizeOptions)(host, schema);
15
+ const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { skipFormat: true }));
16
+ (0, create_files_1.createFiles)(host, options);
17
+ (0, add_project_1.addProject)(host, options);
18
+ (0, add_git_ignore_entry_1.addGitIgnoreEntry)(host, options);
19
+ const lintingTask = yield (0, add_linting_1.addLinting)(host, options);
20
+ if (!options.skipFormat) {
21
+ yield (0, devkit_1.formatFiles)(host);
22
+ }
23
+ return (0, devkit_1.runTasksInSerial)(initTask, lintingTask);
24
+ });
25
+ }
26
+ exports.detoxApplicationGenerator = detoxApplicationGenerator;
27
+ exports.default = detoxApplicationGenerator;
28
+ exports.detoxApplicationSchematic = (0, devkit_1.convertNxGenerator)(detoxApplicationGenerator);
29
+ //# sourceMappingURL=application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/detox/src/generators/application/application.ts"],"names":[],"mappings":";;;;AAAA,uCAKoB;AAEpB,uCAA8C;AAC9C,qEAA+D;AAC/D,mDAA+C;AAC/C,mDAA+C;AAC/C,qDAAiD;AACjD,+DAA2D;AAG3D,SAAsB,yBAAyB,CAAC,IAAU,EAAE,MAAc;;QACxE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,MAAM,QAAQ,GAAG,MAAM,IAAA,cAAkB,EAAC,IAAI,kCACzC,OAAO,KACV,UAAU,EAAE,IAAI,IAChB,CAAC;QACH,IAAA,0BAAW,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3B,IAAA,wBAAU,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1B,IAAA,wCAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEjC,MAAM,WAAW,GAAG,MAAM,IAAA,wBAAU,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEpD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,yBAAgB,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACjD,CAAC;CAAA;AAlBD,8DAkBC;AAED,kBAAe,yBAAyB,CAAC;AAC5B,QAAA,yBAAyB,GAAG,IAAA,2BAAkB,EACzD,yBAAyB,CAC1B,CAAC"}
@@ -0,0 +1,11 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@nrwl/react/babel",
5
+ {
6
+ "runtime": "automatic"
7
+ }
8
+ ]
9
+ ],
10
+ "plugins": []
11
+ }
@@ -0,0 +1,102 @@
1
+ {
2
+ "testRunner": "jest",
3
+ "runnerConfig": "jest.config.json",
4
+ "apps": {
5
+ "ios.debug": {
6
+ "type": "ios.app",
7
+ "build": "cd <%= offsetFromRoot %><%= appRoot %>/ios && xcodebuild -workspace <%= appClassName %>.xcworkspace -scheme <%= appClassName %> -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
8
+ "binaryPath": "<%= offsetFromRoot %><%= appRoot %>/ios/build/Build/Products/Debug-iphonesimulator/<%= appClassName %>.app"
9
+ },
10
+ "ios.release": {
11
+ "type": "ios.app",
12
+ "build": "cd <%= offsetFromRoot %><%= appRoot %>/ios && xcodebuild -workspace <%= appClassName %>.xcworkspace -scheme <%= appClassName %> -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
13
+ "binaryPath": "<%= offsetFromRoot %><%= appRoot %>/ios/build/Build/Products/Release-iphonesimulator/<%= appClassName %>.app"
14
+ },
15
+ <% if (framework === 'expo') { %>
16
+ "ios.eas": {
17
+ "type": "ios.app",
18
+ "build": "<%= exec %> nx run <%= appFileName %>:download --platform ios --distribution simulator --output=<%= appRoot %>/dist/",
19
+ "binaryPath": "<%= offsetFromRoot %><%= appRoot %>/dist/<%= appExpoName %>.app"
20
+ },
21
+ "ios.local": {
22
+ "type": "ios.app",
23
+ "build": "<%= exec %> nx run <%= appFileName %>:build --platform ios --profile preview --wait --local --no-interactive --output=<%= appRoot %>/dist/",
24
+ "binaryPath": "<%= offsetFromRoot %><%= appRoot %>/dist/<%= appExpoName %>.app"
25
+ },
26
+ <% } %>
27
+ "android.debug": {
28
+ "type": "android.apk",
29
+ "build": "cd <%= offsetFromRoot %><%= appRoot %>/android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug",
30
+ "binaryPath": "<%= offsetFromRoot %><%= appRoot %>/android/app/build/outputs/apk/debug/app-debug.apk"
31
+ },
32
+ "android.release": {
33
+ "type": "android.apk",
34
+ "build": "cd <%= offsetFromRoot %><%= appRoot %>/android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release",
35
+ "binaryPath": "<%= offsetFromRoot %><%= appRoot %>/android/app/build/outputs/apk/release/app-release.apk"
36
+ },
37
+ <% if (framework === 'expo') { %>
38
+ "android.eas": {
39
+ "type": "ios.app",
40
+ "build": "<%= exec %> nx run <%= appFileName %>:download --platform android --output=<%= appRoot %>/dist/",
41
+ "binaryPath": "<%= offsetFromRoot %><%= appRoot %>/dist/<%= appExpoName %>.apk"
42
+ },
43
+ "android.local": {
44
+ "type": "ios.app",
45
+ "build": "<%= exec %> nx run <%= appFileName %>:build --platform android --profile preview --wait --local --no-interactive --output=<%= appRoot %>/dist/",
46
+ "binaryPath": "<%= offsetFromRoot %><%= appRoot %>/dist/<%= appExpoName %>.apk"
47
+ },
48
+ <% } %>
49
+ },
50
+ "devices": {
51
+ "simulator": {
52
+ "type": "ios.simulator",
53
+ "device": {
54
+ "type": "iPhone 14"
55
+ }
56
+ },
57
+ "emulator": {
58
+ "type": "android.emulator",
59
+ "device": {
60
+ "avdName": "Pixel_4a_API_30"
61
+ }
62
+ }
63
+ },
64
+ "configurations": {
65
+ "ios.sim.release": {
66
+ "device": "simulator",
67
+ "app": "ios.release"
68
+ },
69
+ "ios.sim.debug": {
70
+ "device": "simulator",
71
+ "app": "ios.debug"
72
+ },
73
+ <% if (framework === 'expo') { %>
74
+ "ios.sim.eas": {
75
+ "device": "simulator",
76
+ "app": "ios.eas"
77
+ },
78
+ "ios.sim.local": {
79
+ "device": "simulator",
80
+ "app": "ios.local"
81
+ },
82
+ <% } %>
83
+ "android.emu.release": {
84
+ "device": "emulator",
85
+ "app": "android.release"
86
+ },
87
+ "android.emu.debug": {
88
+ "device": "emulator",
89
+ "app": "android.debug"
90
+ },
91
+ <% if (framework === 'expo') { %>
92
+ "android.emu.eas": {
93
+ "device": "simulator",
94
+ "app": "android.eas"
95
+ },
96
+ "android.emu.local": {
97
+ "device": "simulator",
98
+ "app": "android.local"
99
+ },
100
+ <% } %>
101
+ }
102
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "preset": "<%= offsetFromRoot %>jest.preset",
3
+ "testTimeout": 120000,
4
+ "maxWorkers": 1,
5
+ "globalSetup": "detox/runners/jest/globalSetup",
6
+ "globalTeardown": "detox/runners/jest/globalTeardown",
7
+ "reporters": ["detox/runners/jest/reporter"],
8
+ "testEnvironment": "detox/runners/jest/testEnvironment",
9
+ "verbose": true,
10
+ "setupFilesAfterEnv": ["<rootDir>/test-setup.ts"],
11
+ "transform": {
12
+ "^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "@nrwl/react/plugins/jest",
13
+ "^.+\\.[tj]sx?$": "babel-jest"
14
+ }
15
+ }
@@ -0,0 +1,11 @@
1
+ import { device, element, by, expect } from 'detox';
2
+
3
+ describe('<%= appClassName %>', () => {
4
+ beforeEach(async () => {
5
+ await device.reloadReactNative();
6
+ });
7
+
8
+ it('should display welcome message', async () => {
9
+ await expect(element(by.id('heading'))).toHaveText('Welcome <%= appDisplayName %> 👋');
10
+ });
11
+ });
@@ -0,0 +1,5 @@
1
+ import { device } from 'detox';
2
+
3
+ beforeAll(async () => {
4
+ await device.launchApp();
5
+ });
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "sourceMap": false,
5
+ "outDir": "<%= offsetFromRoot %>dist/out-tsc",
6
+ "allowJs": true,
7
+ "types": ["node", "jest", "detox"]
8
+ },
9
+ "include": ["src/**/*.ts", "src/**/*.js"]
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "<%= rootTsConfigPath %>",
3
+ "files": [],
4
+ "include": [],
5
+ "references": [
6
+ {
7
+ "path": "./tsconfig.e2e.json"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function addGitIgnoreEntry(host: Tree, options: NormalizedSchema): void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addGitIgnoreEntry = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function addGitIgnoreEntry(host, options) {
6
+ if (host.exists('.gitignore')) {
7
+ let content = host.read('.gitignore', 'utf-8');
8
+ content = `${content}\n${options.e2eProjectRoot}/artifacts\n`;
9
+ host.write('.gitignore', content);
10
+ }
11
+ else {
12
+ devkit_1.logger.warn(`Couldn't find .gitignore file to update`);
13
+ }
14
+ }
15
+ exports.addGitIgnoreEntry = addGitIgnoreEntry;
16
+ //# sourceMappingURL=add-git-ignore-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-git-ignore-entry.js","sourceRoot":"","sources":["../../../../../../../packages/detox/src/generators/application/lib/add-git-ignore-entry.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAG1C,SAAgB,iBAAiB,CAAC,IAAU,EAAE,OAAyB;IACrE,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC7B,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO,GAAG,GAAG,OAAO,KAAK,OAAO,CAAC,cAAc,cAAc,CAAC;QAC9D,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;KACnC;SAAM;QACL,eAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;KACxD;AACH,CAAC;AARD,8CAQC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function addLinting(host: Tree, options: NormalizedSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addLinting = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const linter_1 = require("@nx/linter");
6
+ const devkit_1 = require("@nx/devkit");
7
+ const react_1 = require("@nx/react");
8
+ function addLinting(host, options) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ if (options.linter === linter_1.Linter.None) {
11
+ return () => { };
12
+ }
13
+ const lintTask = yield (0, linter_1.lintProjectGenerator)(host, {
14
+ linter: options.linter,
15
+ project: options.e2eProjectName,
16
+ tsConfigPaths: [
17
+ (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'tsconfig.app.json'),
18
+ ],
19
+ eslintFilePatterns: [`${options.e2eProjectRoot}/**/*.{ts,tsx,js,jsx}`],
20
+ skipFormat: true,
21
+ });
22
+ (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, '.eslintrc.json'), react_1.extendReactEslintJson);
23
+ const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, react_1.extraEslintDependencies.dependencies, react_1.extraEslintDependencies.devDependencies);
24
+ return (0, devkit_1.runTasksInSerial)(lintTask, installTask);
25
+ });
26
+ }
27
+ exports.addLinting = addLinting;
28
+ //# sourceMappingURL=add-linting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-linting.js","sourceRoot":"","sources":["../../../../../../../packages/detox/src/generators/application/lib/add-linting.ts"],"names":[],"mappings":";;;;AAAA,uCAA0D;AAC1D,uCAMoB;AACpB,qCAA2E;AAG3E,SAAsB,UAAU,CAAC,IAAU,EAAE,OAAyB;;QACpE,IAAI,OAAO,CAAC,MAAM,KAAK,eAAM,CAAC,IAAI,EAAE;YAClC,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;SACjB;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,6BAAoB,EAAC,IAAI,EAAE;YAChD,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,cAAc;YAC/B,aAAa,EAAE;gBACb,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,mBAAmB,CAAC;aAC/D;YACD,kBAAkB,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,uBAAuB,CAAC;YACtE,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,IAAA,mBAAU,EACR,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,gBAAgB,CAAC,EAC3D,6BAAqB,CACtB,CAAC;QAEF,MAAM,WAAW,GAAG,IAAA,qCAA4B,EAC9C,IAAI,EACJ,+BAAuB,CAAC,YAAY,EACpC,+BAAuB,CAAC,eAAe,CACxC,CAAC;QAEF,OAAO,IAAA,yBAAgB,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACjD,CAAC;CAAA;AA5BD,gCA4BC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function addProject(host: Tree, options: NormalizedSchema): void;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addProject = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const get_targets_1 = require("./get-targets");
6
+ function addProject(host, options) {
7
+ (0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
8
+ root: options.e2eProjectRoot,
9
+ sourceRoot: `${options.e2eProjectRoot}/src`,
10
+ projectType: 'application',
11
+ targets: Object.assign({}, getTargets(options)),
12
+ tags: [],
13
+ implicitDependencies: [options.appProject],
14
+ });
15
+ }
16
+ exports.addProject = addProject;
17
+ function getTargets(options) {
18
+ const targets = {};
19
+ targets['build-ios'] = Object.assign({ executor: '@nrwl/detox:build' }, (options.framework === 'react-native'
20
+ ? (0, get_targets_1.reactNativeBuildTarget)('ios.sim')
21
+ : (0, get_targets_1.expoBuildTarget)('ios.sim')));
22
+ targets['test-ios'] = Object.assign({ executor: '@nrwl/detox:test' }, (options.framework === 'react-native'
23
+ ? (0, get_targets_1.reactNativeTestTarget)('ios.sim', options.e2eName)
24
+ : (0, get_targets_1.expoTestTarget)('ios.sim', options.e2eName)));
25
+ targets['build-android'] = Object.assign({ executor: '@nrwl/detox:build' }, (options.framework === 'react-native'
26
+ ? (0, get_targets_1.reactNativeBuildTarget)('android.emu')
27
+ : (0, get_targets_1.expoBuildTarget)('android.emu')));
28
+ targets['test-android'] = Object.assign({ executor: '@nrwl/detox:test' }, (options.framework === 'react-native'
29
+ ? (0, get_targets_1.reactNativeTestTarget)('android.emu', options.e2eName)
30
+ : (0, get_targets_1.expoTestTarget)('android.emu', options.e2eName)));
31
+ return targets;
32
+ }
33
+ //# sourceMappingURL=add-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-project.js","sourceRoot":"","sources":["../../../../../../../packages/detox/src/generators/application/lib/add-project.ts"],"names":[],"mappings":";;;AAAA,uCAAgF;AAChF,+CAKuB;AAGvB,SAAgB,UAAU,CAAC,IAAU,EAAE,OAAyB;IAC9D,IAAA,gCAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE;QACpD,IAAI,EAAE,OAAO,CAAC,cAAc;QAC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EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CACpD,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function createFiles(host: Tree, options: NormalizedSchema): void;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createFiles = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const js_1 = require("@nx/js");
6
+ const path_1 = require("path");
7
+ function createFiles(host, options) {
8
+ (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app'), options.e2eProjectRoot, Object.assign(Object.assign({}, options), { exec: (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(host.root)).exec, offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot), rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.e2eProjectRoot) }));
9
+ if (options.js) {
10
+ (0, devkit_1.toJS)(host);
11
+ }
12
+ }
13
+ exports.createFiles = createFiles;
14
+ //# sourceMappingURL=create-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-files.js","sourceRoot":"","sources":["../../../../../../../packages/detox/src/generators/application/lib/create-files.ts"],"names":[],"mappings":";;;AAAA,uCAOoB;AACpB,+BAAuD;AACvD,+BAA4B;AAG5B,SAAgB,WAAW,CAAC,IAAU,EAAE,OAAyB;IAC/D,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,kCACtE,OAAO,KACV,IAAI,EAAE,IAAA,iCAAwB,EAAC,IAAA,6BAAoB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EACpE,cAAc,EAAE,IAAA,uBAAc,EAAC,OAAO,CAAC,cAAc,CAAC,EACtD,gBAAgB,EAAE,IAAA,kCAA6B,EAC7C,IAAI,EACJ,OAAO,CAAC,cAAc,CACvB,IACD,CAAC;IACH,IAAI,OAAO,CAAC,EAAE,EAAE;QACd,IAAA,aAAI,EAAC,IAAI,CAAC,CAAC;KACZ;AACH,CAAC;AAbD,kCAaC"}