@nx/cypress 22.7.0-pr.35019.f500fd7 → 22.7.0-rc.0
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 +8 -9
- package/plugins/cypress-preset.d.ts +1 -1
- package/plugins/cypress-preset.d.ts.map +1 -1
- package/src/generators/component-configuration/component-configuration.d.ts.map +1 -1
- package/src/generators/component-configuration/component-configuration.js +12 -0
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +8 -6
- package/src/plugins/preprocessor-vite.d.ts +1 -1
- package/src/plugins/preprocessor-vite.d.ts.map +1 -1
- package/src/plugins/preprocessor-vite.js +2 -2
- package/project.json +0 -58
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "22.7.0-
|
|
3
|
+
"version": "22.7.0-rc.0",
|
|
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": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"Testing"
|
|
23
23
|
],
|
|
24
24
|
"main": "./index.js",
|
|
25
|
-
"
|
|
25
|
+
"type": "commonjs",
|
|
26
|
+
"types": "./index.d.ts",
|
|
26
27
|
"author": "Victor Savkin",
|
|
27
28
|
"license": "MIT",
|
|
28
29
|
"bugs": {
|
|
@@ -36,9 +37,9 @@
|
|
|
36
37
|
"migrations": "./migrations.json"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@nx/devkit": "22.7.0-
|
|
40
|
-
"@nx/eslint": "22.7.0-
|
|
41
|
-
"@nx/js": "22.7.0-
|
|
40
|
+
"@nx/devkit": "22.7.0-rc.0",
|
|
41
|
+
"@nx/eslint": "22.7.0-rc.0",
|
|
42
|
+
"@nx/js": "22.7.0-rc.0",
|
|
42
43
|
"@phenomnomnominal/tsquery": "~6.1.4",
|
|
43
44
|
"detect-port": "^1.5.1",
|
|
44
45
|
"semver": "^7.6.3",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"tslib": "^2.3.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"nx": "22.7.0-
|
|
50
|
+
"nx": "22.7.0-rc.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"cypress": ">= 13 < 16"
|
|
@@ -58,7 +59,5 @@
|
|
|
58
59
|
},
|
|
59
60
|
"publishConfig": {
|
|
60
61
|
"access": "public"
|
|
61
|
-
}
|
|
62
|
-
"types": "./index.d.ts",
|
|
63
|
-
"type": "commonjs"
|
|
62
|
+
}
|
|
64
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress-preset.d.ts","sourceRoot":"","sources":["../../../../packages/cypress/plugins/cypress-preset.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cypress-preset.d.ts","sourceRoot":"","sources":["../../../../packages/cypress/plugins/cypress-preset.ts"],"names":[],"mappings":"AAUA,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAYxC,UAAU,iBAAiB;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CAC5B;AAID,MAAM,WAAW,+BACf,SAAQ,IAAI,CAAC,yBAAyB,EAAE,SAAS,CAAC;CAAG;AAEvD,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE;IAAE,WAAW,EAAE,WAAW,GAAG,KAAK,CAAA;CAAE,GAC7C,iBAAiB,CAwBnB;AA6CD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CACzB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,yBAAyB,OAkEpC;AA0DD,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;QAII;IACJ,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE3C;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;OAEG;IACH,mBAAmB,CAAC,EAAE,YAAY,CAAC;CACpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/component-configuration/component-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/component-configuration/component-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAIjB,oBAAoB,EAKpB,IAAI,EAIL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,mCAAmC,EAAE,MAAM,UAAU,CAAC;AAI/D,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mCAAmC,8BAM7C;AAED,wBAAsB,uCAAuC,CAC3D,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mCAAmC,8BAwD7C;AAkHD,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,oBAAoB,QAsDpC;AAOD,eAAe,+BAA+B,CAAC"}
|
|
@@ -6,6 +6,7 @@ exports.updateTsConfigForComponentTesting = updateTsConfigForComponentTesting;
|
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
8
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
|
+
const semver_1 = require("semver");
|
|
9
10
|
const versions_1 = require("../../utils/versions");
|
|
10
11
|
const base_setup_1 = require("../base-setup/base-setup");
|
|
11
12
|
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
@@ -17,6 +18,17 @@ function componentConfigurationGenerator(tree, options) {
|
|
|
17
18
|
}
|
|
18
19
|
async function componentConfigurationGeneratorInternal(tree, options) {
|
|
19
20
|
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'cypress', 'component-configuration');
|
|
21
|
+
// Cypress CT does not support Vite 8 yet (@cypress/vite-dev-server
|
|
22
|
+
// peer dep is ^5.0.0 || ^6.0.0 || ^7.0.0).
|
|
23
|
+
const viteVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'vite');
|
|
24
|
+
if (viteVersion) {
|
|
25
|
+
const viteMajor = (0, semver_1.major)((0, semver_1.coerce)(viteVersion));
|
|
26
|
+
if (viteMajor >= 8) {
|
|
27
|
+
throw new Error(`Cypress component testing does not yet support Vite ${viteMajor}. ` +
|
|
28
|
+
`Downgrade to Vite 7 or earlier to use Cypress component testing. ` +
|
|
29
|
+
`See: https://github.com/cypress-io/cypress/issues/33078`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
const tasks = [];
|
|
21
33
|
const opts = normalizeOptions(tree, options);
|
|
22
34
|
if (!(0, versions_1.getInstalledCypressMajorVersion)(tree)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAQnB,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAQnB,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC;AAcD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,oBAAoB,CAwB3D,CAAC;AAEF,eAAO,MAAM,aAAa,qCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -24,15 +24,15 @@ const defaultPatterns = {
|
|
|
24
24
|
excludeSpecPattern: ['/snapshots/*', '/image_snapshots/*'],
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
|
-
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
28
27
|
exports.createNodes = [
|
|
29
28
|
cypressConfigGlob,
|
|
30
29
|
async (configFiles, options, context) => {
|
|
31
30
|
const optionsHash = (0, devkit_internals_1.hashObject)(options);
|
|
32
31
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `cypress-${optionsHash}.hash`);
|
|
33
32
|
const pluginCache = new plugin_cache_utils_1.PluginCache(cachePath);
|
|
33
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
|
|
34
34
|
try {
|
|
35
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, pluginCache), configFiles, options, context);
|
|
35
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, pluginCache, pmc), configFiles, options, context);
|
|
36
36
|
}
|
|
37
37
|
finally {
|
|
38
38
|
pluginCache.writeToDisk(cachePath);
|
|
@@ -40,7 +40,7 @@ exports.createNodes = [
|
|
|
40
40
|
},
|
|
41
41
|
];
|
|
42
42
|
exports.createNodesV2 = exports.createNodes;
|
|
43
|
-
async function createNodesInternal(configFilePath, options, context, pluginCache) {
|
|
43
|
+
async function createNodesInternal(configFilePath, options, context, pluginCache, pmc) {
|
|
44
44
|
options = normalizeOptions(options);
|
|
45
45
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
46
46
|
// Do not create a project if package.json and project.json isn't there.
|
|
@@ -49,9 +49,11 @@ async function createNodesInternal(configFilePath, options, context, pluginCache
|
|
|
49
49
|
!siblingFiles.includes('project.json')) {
|
|
50
50
|
return {};
|
|
51
51
|
}
|
|
52
|
-
const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
|
|
52
|
+
const hash = (await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
|
|
53
|
+
(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
|
|
54
|
+
])) + configFilePath;
|
|
53
55
|
if (!pluginCache.has(hash)) {
|
|
54
|
-
pluginCache.set(hash, await buildCypressTargets(configFilePath, projectRoot, options, context));
|
|
56
|
+
pluginCache.set(hash, await buildCypressTargets(configFilePath, projectRoot, options, context, pmc));
|
|
55
57
|
}
|
|
56
58
|
const { targets, metadata } = pluginCache.get(hash);
|
|
57
59
|
const project = {
|
|
@@ -140,7 +142,7 @@ function getOutputs(projectRoot, cypressConfig, testingType) {
|
|
|
140
142
|
}
|
|
141
143
|
return outputs;
|
|
142
144
|
}
|
|
143
|
-
async function buildCypressTargets(configFilePath, projectRoot, options, context) {
|
|
145
|
+
async function buildCypressTargets(configFilePath, projectRoot, options, context, pmc) {
|
|
144
146
|
const cypressConfig = await (0, config_utils_1.loadConfigFile)((0, path_1.join)(context.workspaceRoot, configFilePath));
|
|
145
147
|
const pluginPresetOptions = {
|
|
146
148
|
...cypressConfig.e2e?.[constants_1.NX_PLUGIN_OPTIONS],
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
23
23
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
24
|
**/
|
|
25
|
-
|
|
25
|
+
type InlineConfig = Record<string, any>;
|
|
26
26
|
type CypressPreprocessor = (file: Record<string, any>) => string | Promise<string>;
|
|
27
27
|
/**
|
|
28
28
|
* Use Vite as a file preprocess for Cypress test files.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preprocessor-vite.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/plugins/preprocessor-vite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;IAuBI;
|
|
1
|
+
{"version":3,"file":"preprocessor-vite.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/plugins/preprocessor-vite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;IAuBI;AAMJ,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAExC,KAAK,mBAAmB,GAAG,CACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KACtB,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAI9B;;;;GAIG;AACH,iBAAS,gBAAgB,CACvB,eAAe,GAAE,YAAiB,GACjC,mBAAmB,CAkErB;AAUD,eAAe,gBAAgB,CAAC"}
|
|
@@ -61,10 +61,10 @@ function vitePreprocessor(configOverrides = {}) {
|
|
|
61
61
|
};
|
|
62
62
|
cache.set(filePath, outputPath);
|
|
63
63
|
const { build } = await Function('return import("vite")')();
|
|
64
|
-
const watcher =
|
|
64
|
+
const watcher = await build({
|
|
65
65
|
...defaultConfig,
|
|
66
66
|
...configOverrides,
|
|
67
|
-
})
|
|
67
|
+
});
|
|
68
68
|
return new Promise((resolve, reject) => {
|
|
69
69
|
if (shouldWatch && isWatcher(watcher)) {
|
|
70
70
|
watcher.on('event', (event) => {
|
package/project.json
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cypress",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "packages/cypress",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"outputs": ["{workspaceRoot}/dist/packages/cypress/README.md"],
|
|
9
|
-
"command": "node ./scripts/copy-readme.js cypress",
|
|
10
|
-
"dependsOn": ["^build", "build-base", "legacy-post-build"]
|
|
11
|
-
},
|
|
12
|
-
"legacy-post-build": {
|
|
13
|
-
"executor": "@nx/workspace-plugin:legacy-post-build",
|
|
14
|
-
"options": {
|
|
15
|
-
"tsConfig": "./tsconfig.lib.json",
|
|
16
|
-
"assets": [
|
|
17
|
-
{
|
|
18
|
-
"input": "packages/cypress",
|
|
19
|
-
"glob": "**/files/**",
|
|
20
|
-
"output": "/"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"input": "packages/cypress",
|
|
24
|
-
"glob": "**/files/**/.gitkeep",
|
|
25
|
-
"output": "/"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"input": "packages/cypress",
|
|
29
|
-
"glob": "**/*.json",
|
|
30
|
-
"ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
|
|
31
|
-
"output": "/"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"input": "packages/cypress",
|
|
35
|
-
"glob": "**/*.js",
|
|
36
|
-
"ignore": ["**/jest.config.js"],
|
|
37
|
-
"output": "/"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"input": "packages/cypress",
|
|
41
|
-
"glob": "**/*.d.ts",
|
|
42
|
-
"output": "/"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"input": "packages/cypress",
|
|
46
|
-
"glob": "PLUGIN.md",
|
|
47
|
-
"output": "/"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"input": "",
|
|
51
|
-
"glob": "LICENSE",
|
|
52
|
-
"output": "/"
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|