Skip to content

Commit

Permalink
chore(cypress): remove some custom transpilation (#2066)
Browse files Browse the repository at this point in the history
It's not necessary anymore, Cypress works just fine with TS files now.
The transpilation is kept for files that are loaded from served HTML
files though as that has to be transpiled manually.
  • Loading branch information
Thomaash authored Nov 13, 2023
1 parent 016d821 commit d2c15bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
8 changes: 4 additions & 4 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export default defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
async setupNodeEvents(on, config) {
return (await import("./cypress/plugins/index.js")).default(on, config);
return (await import("./cypress/plugins/index.ts")).default(on, config);
},
specPattern: [
"cypress/e2e/visual/**/*.spec.js",
"cypress/e2e/functional/**/*.spec.js",
"cypress/e2e/visual/**/*.spec.ts",
"cypress/e2e/functional/**/*.spec.ts",
],
supportFile: "cypress/support/e2e.js",
supportFile: "cypress/support/e2e.ts",
},
});
8 changes: 4 additions & 4 deletions cypress/plugins/index.js → cypress/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
const getCompareSnapshotsPlugin = require("cypress-visual-regression/dist/plugin");
import getCompareSnapshotsPlugin from "cypress-visual-regression/dist/plugin";

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

module.exports = (on, config) => {
export default (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config

Expand All @@ -22,7 +22,7 @@ module.exports = (on, config) => {

if (all || config.env.VISUAL) {
// Visual regression screenshot tests.
config.specPattern.push("cypress/e2e/visual/**/*.spec.js");
config.specPattern.push("cypress/e2e/visual/**/*.spec.ts");
config.env.failSilently = false;
config.trashAssetsBeforeRuns = true;

Expand All @@ -39,7 +39,7 @@ module.exports = (on, config) => {

if (all || config.env.FUNCTIONAL) {
// Functional tests.
config.specPattern.push("cypress/e2e/functional/**/*.spec.js");
config.specPattern.push("cypress/e2e/functional/**/*.spec.ts");
}

return config;
Expand Down
9 changes: 3 additions & 6 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"compilerOptions": {
"baseUrl": ".",
"lib": ["esnext", "dom"],
"module": "es2020",
"outDir": ".",
"target": "es2015",
"types": ["cypress"]
"outDir": "."
},
"exclude": ["../node_modules", "./plugins", "./screenshots", "./videos"],
"include": ["**/*.ts"]
"exclude": ["../node_modules"],
"include": ["pages/**/*.ts"]
}

0 comments on commit d2c15bf

Please sign in to comment.