@nx/cypress 17.2.0-beta.12 → 17.2.0-beta.15
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/package.json +5 -5
- package/src/plugins/plugin.js +24 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "17.2.0-beta.
|
|
3
|
+
"version": "17.2.0-beta.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Cypress contains executors and generators allowing your workspace to use the powerful Cypress integration testing capabilities.",
|
|
6
6
|
"repository": {
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"migrations": "./migrations.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nx/devkit": "17.2.0-beta.
|
|
38
|
-
"@nx/eslint": "17.2.0-beta.
|
|
39
|
-
"@nx/js": "17.2.0-beta.
|
|
37
|
+
"@nx/devkit": "17.2.0-beta.15",
|
|
38
|
+
"@nx/eslint": "17.2.0-beta.15",
|
|
39
|
+
"@nx/js": "17.2.0-beta.15",
|
|
40
40
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
41
41
|
"detect-port": "^1.5.1",
|
|
42
42
|
"semver": "7.5.3",
|
|
43
43
|
"tslib": "^2.3.0",
|
|
44
|
-
"@nrwl/cypress": "17.2.0-beta.
|
|
44
|
+
"@nrwl/cypress": "17.2.0-beta.15"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"cypress": ">= 3 < 14"
|
package/src/plugins/plugin.js
CHANGED
|
@@ -5,7 +5,6 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const internal_1 = require("@nx/js/src/internal");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
|
-
const project_configuration_utils_1 = require("nx/src/project-graph/utils/project-configuration-utils");
|
|
9
8
|
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
10
9
|
const fs_1 = require("fs");
|
|
11
10
|
const workspace_context_1 = require("nx/src/utils/workspace-context");
|
|
@@ -105,20 +104,11 @@ function buildCypressTargets(configFilePath, projectRoot, options, context) {
|
|
|
105
104
|
if ('e2e' in cypressConfig) {
|
|
106
105
|
targets[options.targetName] = {
|
|
107
106
|
command: `cypress run --config-file ${relativeConfigPath} --e2e`,
|
|
108
|
-
options: {
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
options: { cwd: projectRoot },
|
|
108
|
+
cache: true,
|
|
109
|
+
inputs: getInputs(namedInputs),
|
|
110
|
+
outputs: getOutputs(projectRoot, cypressConfig, 'e2e'),
|
|
111
111
|
};
|
|
112
|
-
const e2eTargetDefaults = (0, project_configuration_utils_1.readTargetDefaultsForTarget)(options.targetName, context.nxJsonConfiguration.targetDefaults, 'run-commands');
|
|
113
|
-
if (e2eTargetDefaults?.cache === undefined) {
|
|
114
|
-
targets[options.targetName].cache = true;
|
|
115
|
-
}
|
|
116
|
-
if (e2eTargetDefaults?.inputs === undefined) {
|
|
117
|
-
targets[options.targetName].inputs = getInputs(namedInputs);
|
|
118
|
-
}
|
|
119
|
-
if (e2eTargetDefaults?.outputs === undefined) {
|
|
120
|
-
targets[options.targetName].outputs = getOutputs(projectRoot, cypressConfig, 'e2e');
|
|
121
|
-
}
|
|
122
112
|
if (webServerCommands?.default) {
|
|
123
113
|
delete webServerCommands.default;
|
|
124
114
|
}
|
|
@@ -174,24 +164,14 @@ function buildCypressTargets(configFilePath, projectRoot, options, context) {
|
|
|
174
164
|
}
|
|
175
165
|
}
|
|
176
166
|
if ('component' in cypressConfig) {
|
|
177
|
-
const componentTestingTargetDefaults = (0, project_configuration_utils_1.readTargetDefaultsForTarget)(options.componentTestingTargetName, context.nxJsonConfiguration.targetDefaults, 'nx:run-commands');
|
|
178
167
|
// This will not override the e2e target if it is the same
|
|
179
168
|
targets[options.componentTestingTargetName] ??= {
|
|
180
169
|
command: `cypress open --config-file ${relativeConfigPath} --component`,
|
|
181
|
-
options: {
|
|
182
|
-
|
|
183
|
-
|
|
170
|
+
options: { cwd: projectRoot },
|
|
171
|
+
cache: true,
|
|
172
|
+
inputs: getInputs(namedInputs),
|
|
173
|
+
outputs: getOutputs(projectRoot, cypressConfig, 'component'),
|
|
184
174
|
};
|
|
185
|
-
if (componentTestingTargetDefaults?.cache === undefined) {
|
|
186
|
-
targets[options.componentTestingTargetName].cache = true;
|
|
187
|
-
}
|
|
188
|
-
if (componentTestingTargetDefaults?.inputs === undefined) {
|
|
189
|
-
targets[options.componentTestingTargetName].inputs =
|
|
190
|
-
getInputs(namedInputs);
|
|
191
|
-
}
|
|
192
|
-
if (componentTestingTargetDefaults?.outputs === undefined) {
|
|
193
|
-
targets[options.componentTestingTargetName].outputs = getOutputs(projectRoot, cypressConfig, 'component');
|
|
194
|
-
}
|
|
195
175
|
}
|
|
196
176
|
return targets;
|
|
197
177
|
}
|
|
@@ -203,18 +183,18 @@ function getCypressConfig(configFilePath, context) {
|
|
|
203
183
|
if (tsConfigPath) {
|
|
204
184
|
const unregisterTsProject = (0, internal_1.registerTsProject)(tsConfigPath);
|
|
205
185
|
try {
|
|
206
|
-
module =
|
|
186
|
+
module = load(resolvedPath);
|
|
207
187
|
}
|
|
208
188
|
finally {
|
|
209
189
|
unregisterTsProject();
|
|
210
190
|
}
|
|
211
191
|
}
|
|
212
192
|
else {
|
|
213
|
-
module =
|
|
193
|
+
module = load(resolvedPath);
|
|
214
194
|
}
|
|
215
195
|
}
|
|
216
196
|
else {
|
|
217
|
-
module =
|
|
197
|
+
module = load(resolvedPath);
|
|
218
198
|
}
|
|
219
199
|
return module.default ?? module;
|
|
220
200
|
}
|
|
@@ -235,3 +215,16 @@ function getInputs(namedInputs) {
|
|
|
235
215
|
},
|
|
236
216
|
];
|
|
237
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Load the module after ensuring that the require cache is cleared.
|
|
220
|
+
*/
|
|
221
|
+
function load(path) {
|
|
222
|
+
// Clear cache if the path is in the cache
|
|
223
|
+
if (require.cache[path]) {
|
|
224
|
+
for (const k of Object.keys(require.cache)) {
|
|
225
|
+
delete require.cache[k];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// Then require
|
|
229
|
+
return require(path);
|
|
230
|
+
}
|