@forsakringskassan/cypress-config 1.4.1 → 1.5.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/dist/index.d.ts CHANGED
@@ -25,8 +25,8 @@ export declare type ConfigOptions = Parameters<typeof defineConfig_2>[0];
25
25
  * @public
26
26
  * @since v1.1.0
27
27
  */
28
- export declare const defaultConfig: Readonly<{
29
- allowCypressEnv: false;
28
+ export declare function defaultConfig(cypressMajor: string | undefined): Readonly<{
29
+ allowCypressEnv?: false;
30
30
  video: false;
31
31
  defaultBrowser: string;
32
32
  reporter: string;
package/dist/index.mjs CHANGED
@@ -261,34 +261,47 @@ function htmlValidatePlugin(on, cypressConfig, userConfig, userOptions) {
261
261
  import { createRequire as createRequire3 } from "node:module";
262
262
  var require3 = createRequire3(import.meta.url);
263
263
  var isGithub = Boolean(process.env["GITHUB_ACTION"]);
264
- var defaultConfig = Object.freeze({
265
- allowCypressEnv: false,
266
- /* disable video recording, it is to slow both on remote machines and on
267
- * CI/CD testing. */
268
- video: false,
269
- /* use chrome instead of electron as default browser */
270
- defaultBrowser: "chrome",
271
- /* reporter configuration */
272
- reporter: require3.resolve("mocha-multi-reporters"),
273
- reporterOptions: {
274
- reporterEnabled: isGithub ? "spec, github-actions, mocha-junit-reporter" : "spec, mocha-junit-reporter",
275
- mochaJunitReporterReporterOptions: {
276
- mochaFile: "test-results/cypress-test-output_[hash].xml"
277
- }
278
- },
279
- component: {
280
- devServer: {
281
- framework: "vue",
282
- bundler: "vite"
283
- },
284
- indexHtmlFile: require3.resolve("#assets/component-index.html")
264
+ var versionConfig = Object.freeze({
265
+ "15": {
266
+ /* @ts-expect-error until we drop support for cypress 15 we still want to set this option (removed in cypress 16 and later) */
267
+ allowCypressEnv: false
285
268
  }
286
269
  });
270
+ function hasVersionConfig(key) {
271
+ return Boolean(key && Object.hasOwn(versionConfig, key));
272
+ }
273
+ function defaultConfig(cypressMajor2) {
274
+ return Object.freeze({
275
+ ...hasVersionConfig(cypressMajor2) && versionConfig[cypressMajor2],
276
+ /* disable video recording, it is to slow both on remote machines and on
277
+ * CI/CD testing. */
278
+ video: false,
279
+ /* use chrome instead of electron as default browser */
280
+ defaultBrowser: "chrome",
281
+ /* reporter configuration */
282
+ reporter: require3.resolve("mocha-multi-reporters"),
283
+ reporterOptions: {
284
+ reporterEnabled: isGithub ? "spec, github-actions, mocha-junit-reporter" : "spec, mocha-junit-reporter",
285
+ mochaJunitReporterReporterOptions: {
286
+ mochaFile: "test-results/cypress-test-output_[hash].xml"
287
+ }
288
+ },
289
+ component: {
290
+ devServer: {
291
+ framework: "vue",
292
+ bundler: "vite"
293
+ },
294
+ indexHtmlFile: require3.resolve("#assets/component-index.html")
295
+ }
296
+ });
297
+ }
287
298
 
288
299
  // src/define-config.ts
300
+ import pkg from "cypress/package.json";
301
+ var cypressMajor = pkg.version.split(".", 2).at(0);
289
302
  function defineConfig(_rootDir, userConfig) {
290
303
  return mergeConfig(
291
- defaultConfig,
304
+ defaultConfig(cypressMajor),
292
305
  userConfig
293
306
  );
294
307
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/cypress-config",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Sharable Cypress configuration building blocks for Försäkringskassan",
5
5
  "keywords": [
6
6
  "cypress"
@@ -46,7 +46,7 @@
46
46
  "peerDependencies": {
47
47
  "@fkui/vue": ">= 6.0.0",
48
48
  "@forsakringskassan/docs-generator": "^3.0.0",
49
- "cypress": "^15.17.0",
49
+ "cypress": "^15.17.0 || ^16.0.0",
50
50
  "html-validate": ">= 8.0.0"
51
51
  },
52
52
  "peerDependenciesMeta": {