@@ -2,11 +2,6 @@ import path from "path";
2
2
import { promises as fs } from "fs" ;
3
3
import child_process from "child_process" ;
4
4
import { assertAndReturn } from "../lib/helpers/assertions" ;
5
- import { version as cypressVersion } from "cypress/package.json" ;
6
-
7
- export function isPost10 ( ) {
8
- return parseInt ( cypressVersion . split ( "." ) [ 0 ] , 10 ) >= 10 ;
9
- }
10
5
11
6
function aggregatedTitle ( test : Mocha . Suite | Mocha . Test ) : string {
12
7
if ( test . parent ?. title ) {
@@ -36,66 +31,39 @@ describe("Run all specs", () => {
36
31
37
32
await fs . rm ( this . tmpDir , { recursive : true , force : true } ) ;
38
33
39
- if ( isPost10 ( ) ) {
40
- await writeFile (
41
- path . join ( this . tmpDir , "cypress.config.js" ) ,
42
- `
43
- const { defineConfig } = require("cypress");
44
- const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
45
- const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
46
- const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");
47
-
48
- async function setupNodeEvents(on, config) {
49
- // This is required for the preprocessor to be able to generate JSON reports after each run, and more,
50
- await preprocessor.addCucumberPreprocessorPlugin(on, config);
51
-
52
- on(
53
- "file:preprocessor",
54
- createBundler({
55
- plugins: [createEsbuildPlugin.default(config)],
56
- })
57
- );
58
-
59
- // Make sure to return the config object as it might have been modified by the plugin.
60
- return config;
61
- }
62
-
63
- module.exports = defineConfig({
64
- e2e: {
65
- experimentalRunAllSpecs: true,
66
- supportFile: false,
67
- specPattern: "**/*.feature",
68
- setupNodeEvents
69
- },
70
- });
71
- ` ,
72
- ) ;
73
- } else {
74
- await writeFile (
75
- path . join ( this . tmpDir , "cypress.json" ) ,
76
- JSON . stringify ( {
77
- testFiles : "**/*.feature" ,
78
- video : false ,
79
- } ) ,
80
- ) ;
81
-
82
- await writeFile (
83
- path . join ( this . tmpDir , "cypress" , "plugins" , "index.js" ) ,
84
- `
85
- const { createEsbuildPlugin } = require("@badeball/cypress-cucumber-preprocessor/esbuild");
86
- const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
87
-
88
- module.exports = (on, config) => {
89
- on(
90
- "file:preprocessor",
91
- createBundler({
92
- plugins: [createEsbuildPlugin(config)]
93
- })
94
- );
95
- }
96
- ` ,
97
- ) ;
98
- }
34
+ await writeFile (
35
+ path . join ( this . tmpDir , "cypress.config.js" ) ,
36
+ `
37
+ const { defineConfig } = require("cypress");
38
+ const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
39
+ const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
40
+ const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");
41
+
42
+ async function setupNodeEvents(on, config) {
43
+ // This is required for the preprocessor to be able to generate JSON reports after each run, and more,
44
+ await preprocessor.addCucumberPreprocessorPlugin(on, config);
45
+
46
+ on(
47
+ "file:preprocessor",
48
+ createBundler({
49
+ plugins: [createEsbuildPlugin.default(config)],
50
+ })
51
+ );
52
+
53
+ // Make sure to return the config object as it might have been modified by the plugin.
54
+ return config;
55
+ }
56
+
57
+ module.exports = defineConfig({
58
+ e2e: {
59
+ experimentalRunAllSpecs: true,
60
+ supportFile: false,
61
+ specPattern: "**/*.feature",
62
+ setupNodeEvents
63
+ },
64
+ });
65
+ ` ,
66
+ ) ;
99
67
100
68
await fs . mkdir ( path . join ( this . tmpDir , "node_modules" , "@badeball" ) , {
101
69
recursive : true ,
0 commit comments