@forsakringskassan/cypress-config 1.0.1 → 1.2.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/README.md +19 -6
- package/dist/index.d.ts +13 -4
- package/dist/index.mjs +12 -1
- package/dist/support.d.ts +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -2,15 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Sharable Cypress configuration building blocks for Försäkringskassan.
|
|
4
4
|
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @forsakringskassan/cypress-config
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
If you previously had these packages installed, they can be uninstalled:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm rm mocha-multi-reporter
|
|
15
|
+
```
|
|
16
|
+
|
|
5
17
|
## Usage
|
|
6
18
|
|
|
7
|
-
In `cypress.config.ts`, replace the vanilla `defineConfig()` helper from `cypress` with `@forsakringskassan/cypress-config
|
|
19
|
+
In `cypress.config.ts`, replace the vanilla `defineConfig()` helper from `cypress` with `@forsakringskassan/cypress-config` and pass in `import.meta.dirname` as the first parameter:
|
|
8
20
|
|
|
9
21
|
```diff
|
|
10
22
|
-import { defineConfig } from "cypress";
|
|
11
23
|
+import { defineConfig } from "@forsakringskassan/cypress-config";
|
|
12
24
|
|
|
13
|
-
|
|
25
|
+
-export default defineConfig({
|
|
26
|
+
+export default defineConfig(import.meta.dirname, {
|
|
14
27
|
/* ... */
|
|
15
28
|
});
|
|
16
29
|
```
|
|
@@ -18,11 +31,11 @@ In `cypress.config.ts`, replace the vanilla `defineConfig()` helper from `cypres
|
|
|
18
31
|
It works the same but is preconfigured with new defaults.
|
|
19
32
|
|
|
20
33
|
> [!TIP]
|
|
21
|
-
> The `defineConfig()` helper does not require
|
|
22
|
-
> Unless you are explicitly overwriting the default configuration it is recommended to call `defineConfig()` without
|
|
34
|
+
> The `defineConfig()` helper does not require the configuration object as the second parameter.
|
|
35
|
+
> Unless you are explicitly overwriting the default configuration it is recommended to call `defineConfig()` without it.
|
|
23
36
|
>
|
|
24
37
|
> ```ts
|
|
25
|
-
> export default defineConfig();
|
|
38
|
+
> export default defineConfig(import.meta.dirname);
|
|
26
39
|
> ```
|
|
27
40
|
>
|
|
28
41
|
> This ensures maximum compatibility with future releases.
|
|
@@ -56,7 +69,7 @@ import {
|
|
|
56
69
|
htmlValidatePlugin,
|
|
57
70
|
} from "@forsakringskassan/cypress-config";
|
|
58
71
|
|
|
59
|
-
export default defineConfig({
|
|
72
|
+
export default defineConfig(import.meta.dirname, {
|
|
60
73
|
component: {
|
|
61
74
|
async setupNodeEvents(on, config) {
|
|
62
75
|
config = await htmlValidatePlugin(on, config);
|
package/dist/index.d.ts
CHANGED
|
@@ -11,11 +11,19 @@ export declare type ConfigOptions = Parameters<typeof defineConfig_2>[0];
|
|
|
11
11
|
* Default cypress configuration.
|
|
12
12
|
*
|
|
13
13
|
* @public
|
|
14
|
-
* @since v1.0
|
|
14
|
+
* @since v1.1.0
|
|
15
15
|
*/
|
|
16
16
|
export declare const defaultConfig: Readonly<{
|
|
17
17
|
allowCypressEnv: false;
|
|
18
18
|
video: false;
|
|
19
|
+
defaultBrowser: string;
|
|
20
|
+
reporter: string;
|
|
21
|
+
reporterOptions: {
|
|
22
|
+
reporterEnabled: string;
|
|
23
|
+
mochaJunitReporterReporterOptions: {
|
|
24
|
+
mochaFile: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
19
27
|
component: {
|
|
20
28
|
devServer: {
|
|
21
29
|
framework: "vue";
|
|
@@ -27,9 +35,10 @@ export declare const defaultConfig: Readonly<{
|
|
|
27
35
|
|
|
28
36
|
/**
|
|
29
37
|
* @public
|
|
30
|
-
* @since v1.0
|
|
38
|
+
* @since v1.1.0
|
|
39
|
+
* @param _rootDir - path to the root directory (containing the `cypress.config.ts` file).
|
|
31
40
|
*/
|
|
32
|
-
export declare function defineConfig(userConfig?: Omit<ConfigOptions, "component"> & {
|
|
41
|
+
export declare function defineConfig(_rootDir: string, userConfig?: Omit<ConfigOptions, "component"> & {
|
|
33
42
|
component?: Partial<ConfigOptions["component"]>;
|
|
34
43
|
}): Readonly<ConfigOptions>;
|
|
35
44
|
|
|
@@ -37,7 +46,7 @@ export declare function defineConfig(userConfig?: Omit<ConfigOptions, "component
|
|
|
37
46
|
* Preconfigured `cypress-html-validate` plugin.
|
|
38
47
|
*
|
|
39
48
|
* @public
|
|
40
|
-
* @since v1.0
|
|
49
|
+
* @since v1.1.0
|
|
41
50
|
* @param on - Cypress `on` callback from `setupNodeEvents`.
|
|
42
51
|
* @param cypressConfig - Cypress `config` parameter from `setupNodeEvents`.
|
|
43
52
|
* @param userConfig - Custom configuration to pass to `html-validate`.
|
package/dist/index.mjs
CHANGED
|
@@ -197,11 +197,22 @@ function htmlValidatePlugin(on, cypressConfig, userConfig, userOptions) {
|
|
|
197
197
|
// src/default-config.ts
|
|
198
198
|
import { createRequire as createRequire2 } from "node:module";
|
|
199
199
|
var require3 = createRequire2(import.meta.url);
|
|
200
|
+
var isGithub = Boolean(process.env["GITHUB_ACTION"]);
|
|
200
201
|
var defaultConfig = Object.freeze({
|
|
201
202
|
allowCypressEnv: false,
|
|
202
203
|
/* disable video recording, it is to slow both on remote machines and on
|
|
203
204
|
* CI/CD testing. */
|
|
204
205
|
video: false,
|
|
206
|
+
/* use chrome instead of electron as default browser */
|
|
207
|
+
defaultBrowser: "chrome",
|
|
208
|
+
/* reporter configuration */
|
|
209
|
+
reporter: require3.resolve("mocha-multi-reporters"),
|
|
210
|
+
reporterOptions: {
|
|
211
|
+
reporterEnabled: isGithub ? "spec, github-actions, mocha-junit-reporter" : "spec, mocha-junit-reporter",
|
|
212
|
+
mochaJunitReporterReporterOptions: {
|
|
213
|
+
mochaFile: "test-results/cypress-test-output_[hash].xml"
|
|
214
|
+
}
|
|
215
|
+
},
|
|
205
216
|
component: {
|
|
206
217
|
devServer: {
|
|
207
218
|
framework: "vue",
|
|
@@ -212,7 +223,7 @@ var defaultConfig = Object.freeze({
|
|
|
212
223
|
});
|
|
213
224
|
|
|
214
225
|
// src/define-config.ts
|
|
215
|
-
function defineConfig(userConfig) {
|
|
226
|
+
function defineConfig(_rootDir, userConfig) {
|
|
216
227
|
return mergeConfig(
|
|
217
228
|
defaultConfig,
|
|
218
229
|
userConfig
|
package/dist/support.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forsakringskassan/cypress-config",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Sharable Cypress configuration building blocks for Försäkringskassan",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cypress"
|
|
@@ -39,11 +39,12 @@
|
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"cypress-html-validate": "9.0.0"
|
|
42
|
+
"cypress-html-validate": "9.0.0",
|
|
43
|
+
"mocha-multi-reporters": "1.5.1"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"@fkui/vue": ">= 6.0.0",
|
|
46
|
-
"cypress": "^15.
|
|
47
|
+
"cypress": "^15.17.0",
|
|
47
48
|
"html-validate": ">= 8.0.0"
|
|
48
49
|
},
|
|
49
50
|
"engines": {
|