@nx/cypress 17.2.4 → 17.2.5
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/README.md +9 -4
- package/package.json +5 -5
- package/plugins/cypress-preset.d.ts +10 -0
- package/plugins/cypress-preset.js +8 -4
- package/src/plugins/plugin.js +5 -3
- package/src/utils/symbols.d.ts +4 -0
- package/src/utils/symbols.js +7 -0
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
<p style="text-align: center;"
|
|
1
|
+
<p style="text-align: center;">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
+
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
8
|
<div style="text-align: center;">
|
|
4
9
|
|
|
@@ -15,9 +20,9 @@
|
|
|
15
20
|
|
|
16
21
|
<hr>
|
|
17
22
|
|
|
18
|
-
# Nx: Smart
|
|
23
|
+
# Nx: Smart Monorepos · Fast CI
|
|
19
24
|
|
|
20
|
-
Nx is a
|
|
25
|
+
Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
|
|
21
26
|
|
|
22
27
|
This package is a [Cypress plugin for Nx](https://nx.dev/cypress/overview).
|
|
23
28
|
|
|
@@ -59,5 +64,5 @@ npx nx@latest init
|
|
|
59
64
|
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
60
65
|
|
|
61
66
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
62
|
-
width="100%" alt="Nx - Smart
|
|
67
|
+
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
|
63
68
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "v17.2.5",
|
|
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": "
|
|
38
|
-
"@nx/eslint": "
|
|
39
|
-
"@nx/js": "
|
|
37
|
+
"@nx/devkit": "v17.2.5",
|
|
38
|
+
"@nx/eslint": "v17.2.5",
|
|
39
|
+
"@nx/js": "v17.2.5",
|
|
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": "
|
|
44
|
+
"@nrwl/cypress": "v17.2.5"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"cypress": ">= 3 < 14"
|
|
@@ -51,8 +51,18 @@ export type NxCypressE2EPresetOptions = {
|
|
|
51
51
|
* default is 'src'
|
|
52
52
|
**/
|
|
53
53
|
cypressDir?: string;
|
|
54
|
+
/**
|
|
55
|
+
* A map of commandName -> command to start the web server for testing.
|
|
56
|
+
* Currently only default is read.
|
|
57
|
+
*/
|
|
54
58
|
webServerCommands?: Record<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* A command to start the web server - used for e2e tests distributed by Nx.
|
|
61
|
+
*/
|
|
55
62
|
ciWebServerCommand?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Configures how the web server command is started and monitored.
|
|
65
|
+
*/
|
|
56
66
|
webServerConfig?: WebServerConfig;
|
|
57
67
|
};
|
|
58
68
|
export {};
|
|
@@ -5,6 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const preprocessor_vite_1 = require("../src/plugins/preprocessor-vite");
|
|
8
|
+
const symbols_1 = require("../src/utils/symbols");
|
|
8
9
|
const child_process_1 = require("child_process");
|
|
9
10
|
const http_1 = require("http");
|
|
10
11
|
const https_1 = require("https");
|
|
@@ -55,25 +56,28 @@ function startWebServer(webServerCommand) {
|
|
|
55
56
|
*/
|
|
56
57
|
function nxE2EPreset(pathToConfig, options) {
|
|
57
58
|
const basePath = options?.cypressDir || 'src';
|
|
58
|
-
const baseConfig
|
|
59
|
+
const baseConfig /*Cypress.EndToEndConfigOptions & {
|
|
60
|
+
[NX_PLUGIN_OPTIONS]: unknown;
|
|
61
|
+
}*/ = {
|
|
59
62
|
...nxBaseCypressPreset(pathToConfig),
|
|
60
63
|
fileServerFolder: '.',
|
|
61
64
|
supportFile: `${basePath}/support/e2e.ts`,
|
|
62
65
|
specPattern: `${basePath}/**/*.cy.{js,jsx,ts,tsx}`,
|
|
63
66
|
fixturesFolder: `${basePath}/fixtures`,
|
|
64
|
-
|
|
67
|
+
[symbols_1.NX_PLUGIN_OPTIONS]: {
|
|
65
68
|
webServerCommand: options?.webServerCommands?.default,
|
|
66
69
|
webServerCommands: options?.webServerCommands,
|
|
67
70
|
ciWebServerCommand: options?.ciWebServerCommand,
|
|
68
71
|
},
|
|
69
72
|
async setupNodeEvents(on, config) {
|
|
73
|
+
const webServerCommands = config.env?.webServerCommands ?? options?.webServerCommands;
|
|
74
|
+
const webServerCommand = config.env?.webServerCommand ?? webServerCommands?.default;
|
|
70
75
|
if (options?.bundler === 'vite') {
|
|
71
76
|
on('file:preprocessor', (0, preprocessor_vite_1.default)());
|
|
72
77
|
}
|
|
73
|
-
if (!
|
|
78
|
+
if (!options?.webServerCommands) {
|
|
74
79
|
return;
|
|
75
80
|
}
|
|
76
|
-
const webServerCommand = config.env.webServerCommand;
|
|
77
81
|
if (!webServerCommand) {
|
|
78
82
|
return;
|
|
79
83
|
}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -10,6 +10,7 @@ const fs_1 = require("fs");
|
|
|
10
10
|
const workspace_context_1 = require("nx/src/utils/workspace-context");
|
|
11
11
|
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
12
12
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
13
|
+
const symbols_1 = require("../utils/symbols");
|
|
13
14
|
const cachePath = (0, path_1.join)(cache_directory_1.projectGraphCacheDirectory, 'cypress.hash');
|
|
14
15
|
const targetsCache = (0, fs_1.existsSync)(cachePath) ? readTargetsCache() : {};
|
|
15
16
|
const calculatedTargets = {};
|
|
@@ -93,11 +94,12 @@ function getOutputs(projectRoot, cypressConfig, testingType) {
|
|
|
93
94
|
}
|
|
94
95
|
function buildCypressTargets(configFilePath, projectRoot, options, context) {
|
|
95
96
|
const cypressConfig = getCypressConfig(configFilePath, context);
|
|
96
|
-
const
|
|
97
|
+
const pluginPresetOptions = {
|
|
98
|
+
...cypressConfig.e2e?.[symbols_1.NX_PLUGIN_OPTIONS],
|
|
97
99
|
...cypressConfig.env,
|
|
98
100
|
...cypressConfig.e2e?.env,
|
|
99
101
|
};
|
|
100
|
-
const webServerCommands =
|
|
102
|
+
const webServerCommands = pluginPresetOptions?.webServerCommands;
|
|
101
103
|
const relativeConfigPath = (0, path_1.relative)(projectRoot, configFilePath);
|
|
102
104
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
103
105
|
const targets = {};
|
|
@@ -120,7 +122,7 @@ function buildCypressTargets(configFilePath, projectRoot, options, context) {
|
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
|
-
const ciWebServerCommand =
|
|
125
|
+
const ciWebServerCommand = pluginPresetOptions?.ciWebServerCommand;
|
|
124
126
|
if (ciWebServerCommand) {
|
|
125
127
|
const specPatterns = Array.isArray(cypressConfig.e2e.specPattern)
|
|
126
128
|
? cypressConfig.e2e.specPattern.map((p) => (0, path_1.join)(projectRoot, p))
|