@nrwl/cypress 15.9.2 → 15.9.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/cypress",
3
- "version": "15.9.2",
3
+ "version": "15.9.3",
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,10 +34,10 @@
34
34
  "migrations": "./migrations.json"
35
35
  },
36
36
  "dependencies": {
37
- "@nrwl/devkit": "15.9.2",
38
- "@nrwl/js": "15.9.2",
39
- "@nrwl/linter": "15.9.2",
40
- "@nrwl/workspace": "15.9.2",
37
+ "@nrwl/devkit": "15.9.3",
38
+ "@nrwl/js": "15.9.3",
39
+ "@nrwl/linter": "15.9.3",
40
+ "@nrwl/workspace": "15.9.3",
41
41
  "@phenomnomnominal/tsquery": "4.1.1",
42
42
  "detect-port": "^1.5.1",
43
43
  "dotenv": "~10.0.0",
@@ -55,5 +55,5 @@
55
55
  "access": "public"
56
56
  },
57
57
  "types": "./index.d.ts",
58
- "gitHead": "c60dd8b2f03545ba7d9bbf58c10ac7b49f7f3e92"
58
+ "gitHead": "80792b60b9de4322bbd71cd4601d03ab0b294c4e"
59
59
  }
@@ -1,15 +1,32 @@
1
+ /**
2
+ * https://github.com/mammadataei/cypress-vite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2022 Mohammad Ataei
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
9
+ * this software and associated documentation files (the "Software"), to deal in
10
+ * the Software without restriction, including without limitation the rights to
11
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12
+ * the Software, and to permit persons to whom the Software is furnished to do so,
13
+ * subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ **/
1
25
  type CypressPreprocessor = (file: Record<string, any>) => string | Promise<string>;
2
26
  /**
3
- * Cypress preprocessor for running e2e tests using vite.
4
- *
5
- * @param {string} userConfigPath
6
- * @example
7
- * setupNodeEvents(on) {
8
- * on(
9
- * 'file:preprocessor',
10
- * vitePreprocessor(path.resolve(__dirname, './vite.config.ts')),
11
- * )
12
- * },
27
+ * Use Vite as a file preprocess for Cypress test files.
28
+ * This preprocessor shouldn't be used directly.
29
+ * Instead, use the nxE2EPreset(__filename, { bundler: 'vite' }) function instead.
13
30
  */
14
31
  declare function vitePreprocessor(userConfigPath?: string): CypressPreprocessor;
15
32
  export default vitePreprocessor;
@@ -1,25 +1,45 @@
1
1
  "use strict";
2
- // Adapted from: https://github.com/mammadataei/cypress-vite
2
+ /**
3
+ * https://github.com/mammadataei/cypress-vite
4
+ *
5
+ * MIT License
6
+ *
7
+ * Copyright (c) 2022 Mohammad Ataei
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
10
+ * this software and associated documentation files (the "Software"), to deal in
11
+ * the Software without restriction, including without limitation the rights to
12
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
13
+ * the Software, and to permit persons to whom the Software is furnished to do so,
14
+ * subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
21
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
22
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
23
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ **/
3
26
  Object.defineProperty(exports, "__esModule", { value: true });
4
27
  const tslib_1 = require("tslib");
5
- const path = require("path");
28
+ const path_1 = require("path");
29
+ const cache = new Map();
6
30
  /**
7
- * Cypress preprocessor for running e2e tests using vite.
8
- *
9
- * @param {string} userConfigPath
10
- * @example
11
- * setupNodeEvents(on) {
12
- * on(
13
- * 'file:preprocessor',
14
- * vitePreprocessor(path.resolve(__dirname, './vite.config.ts')),
15
- * )
16
- * },
31
+ * Use Vite as a file preprocess for Cypress test files.
32
+ * This preprocessor shouldn't be used directly.
33
+ * Instead, use the nxE2EPreset(__filename, { bundler: 'vite' }) function instead.
17
34
  */
18
35
  function vitePreprocessor(userConfigPath) {
19
36
  return (file) => tslib_1.__awaiter(this, void 0, void 0, function* () {
20
37
  const { outputPath, filePath, shouldWatch } = file;
21
- const fileName = path.basename(outputPath);
22
- const filenameWithoutExtension = path.basename(outputPath, path.extname(outputPath));
38
+ if (cache.has(filePath)) {
39
+ return cache.get(filePath);
40
+ }
41
+ const fileName = (0, path_1.basename)(outputPath);
42
+ const filenameWithoutExtension = (0, path_1.basename)(outputPath, (0, path_1.extname)(outputPath));
23
43
  const defaultConfig = {
24
44
  logLevel: 'silent',
25
45
  define: {
@@ -28,7 +48,7 @@ function vitePreprocessor(userConfigPath) {
28
48
  build: {
29
49
  emptyOutDir: false,
30
50
  minify: false,
31
- outDir: path.dirname(outputPath),
51
+ outDir: (0, path_1.dirname)(outputPath),
32
52
  sourcemap: true,
33
53
  write: true,
34
54
  watch: getWatcherConfig(shouldWatch),
@@ -40,29 +60,37 @@ function vitePreprocessor(userConfigPath) {
40
60
  },
41
61
  },
42
62
  };
63
+ cache.set(filePath, outputPath);
43
64
  const { build } = require('vite');
44
- const watcher = yield build(Object.assign({ configFile: userConfigPath }, defaultConfig));
45
- if (shouldWatch && isWatcher(watcher)) {
46
- watcher.on('event', (event) => {
47
- if (event.code === 'END') {
48
- file.emit('rerun');
49
- }
50
- if (event.code === 'ERROR') {
51
- console.error(event);
52
- }
53
- });
54
- file.on('close', () => {
55
- watcher.close();
56
- });
57
- }
58
- return outputPath;
65
+ const watcher = (yield build(Object.assign({ configFile: userConfigPath }, defaultConfig)));
66
+ return new Promise((resolve, reject) => {
67
+ if (shouldWatch && isWatcher(watcher)) {
68
+ watcher.on('event', (event) => {
69
+ if (event.code === 'END') {
70
+ resolve(outputPath);
71
+ file.emit('rerun');
72
+ }
73
+ if (event.code === 'ERROR') {
74
+ console.error(event);
75
+ reject(new Error(event.error.message));
76
+ }
77
+ });
78
+ file.on('close', () => {
79
+ cache.delete(filePath);
80
+ watcher.close();
81
+ });
82
+ }
83
+ else {
84
+ resolve(outputPath);
85
+ }
86
+ });
59
87
  });
60
88
  }
89
+ function isWatcher(maybeWatcher) {
90
+ return maybeWatcher.on !== undefined;
91
+ }
61
92
  function getWatcherConfig(shouldWatch) {
62
93
  return shouldWatch ? {} : null;
63
94
  }
64
- function isWatcher(watcher) {
65
- return watcher.on !== undefined;
66
- }
67
95
  exports.default = vitePreprocessor;
68
96
  //# sourceMappingURL=preprocessor-vite.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"preprocessor-vite.js","sourceRoot":"","sources":["../../../../../packages/cypress/src/plugins/preprocessor-vite.ts"],"names":[],"mappings":";AAAA,4D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,CAAC;wBACrB,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;qBACxC;gBACH,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;oBACpB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACvB,OAAO,CAAC,KAAK,EAAE,CAAC;gBAClB,CAAC,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,CAAC,UAAU,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,YAAiB;IAClC,OAAO,YAAY,CAAC,EAAE,KAAK,SAAS,CAAC;AACvC,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAoB;IAC5C,OAAO,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACjC,CAAC;AAED,kBAAe,gBAAgB,CAAC"}
@@ -8,7 +8,7 @@ export declare const CY_FILE_MATCHER: RegExp;
8
8
  */
9
9
  export declare function getTempTailwindPath(context: ExecutorContext): string;
10
10
  /**
11
- * Checks if the childProjectName is a decendent of the parentProjectName
11
+ * Checks if the childProjectName is a descendent of the parentProjectName
12
12
  * in the project graph
13
13
  **/
14
14
  export declare function isCtProjectUsingBuildProject(graph: ProjectGraph, parentProjectName: string, childProjectName: string): boolean;
@@ -28,7 +28,7 @@ function getTempTailwindPath(context) {
28
28
  }
29
29
  exports.getTempTailwindPath = getTempTailwindPath;
30
30
  /**
31
- * Checks if the childProjectName is a decendent of the parentProjectName
31
+ * Checks if the childProjectName is a descendent of the parentProjectName
32
32
  * in the project graph
33
33
  **/
34
34
  function isCtProjectUsingBuildProject(graph, parentProjectName, childProjectName) {