Skip to content

Commit 1580175

Browse files
authored
Merge pull request #1293 from asashour/cypress-10
Remove checking for Cypress less than 10.
2 parents 8bf46d4 + 8a1c9d6 commit 1580175

File tree

1 file changed

+33
-65
lines changed

1 file changed

+33
-65
lines changed

Diff for: test/run-all-specs.ts

+33-65
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ import path from "path";
22
import { promises as fs } from "fs";
33
import child_process from "child_process";
44
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-
}
105

116
function aggregatedTitle(test: Mocha.Suite | Mocha.Test): string {
127
if (test.parent?.title) {
@@ -36,66 +31,39 @@ describe("Run all specs", () => {
3631

3732
await fs.rm(this.tmpDir, { recursive: true, force: true });
3833

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+
);
9967

10068
await fs.mkdir(path.join(this.tmpDir, "node_modules", "@badeball"), {
10169
recursive: true,

0 commit comments

Comments
 (0)