diff --git a/cypress.config.ts b/cypress.config.ts index a7d53cf..b864bc6 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,43 +1,18 @@ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor' -import webpack from '@cypress/webpack-preprocessor' +import { createEsbuildPlugin } from '@badeball/cypress-cucumber-preprocessor/esbuild' +import createBundler from '@bahmutov/cypress-esbuild-preprocessor' import { defineConfig } from 'cypress' -const setupNodeEvents = async (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => { - await addCucumberPreprocessorPlugin(on, config, { - omitAfterRunHandler: true, - }) +async function setupNodeEvents( + on: Cypress.PluginEvents, + config: Cypress.PluginConfigOptions, +): Promise { + await addCucumberPreprocessorPlugin(on, config) + on( 'file:preprocessor', - webpack({ - webpackOptions: { - resolve: { - extensions: ['.ts', '.js'], - }, - module: { - rules: [ - { - test: /\.ts$/, - exclude: [/node_modules/], - use: [ - { - loader: 'ts-loader', - }, - ], - }, - { - test: /\.feature$/, - use: [ - { - loader: '@badeball/cypress-cucumber-preprocessor/webpack', - options: config, - }, - ], - }, - ], - }, - }, + createBundler({ + plugins: [createEsbuildPlugin(config)], }), ) diff --git a/cypress/e2e/step_definitions/login.ts b/cypress/e2e/step_definitions/login.ts index b5dcb34..e6192c2 100644 --- a/cypress/e2e/step_definitions/login.ts +++ b/cypress/e2e/step_definitions/login.ts @@ -1,8 +1,10 @@ /* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable import/no-relative-parent-imports */ import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor' -import { loginPage } from '#pages/LoginPage' -import { welcomePage } from '#pages/WelcomePage' +import { loginPage } from '../../pages/LoginPage' +import { welcomePage } from '../../pages/WelcomePage' Given('The web browser is at the login page', () => { cy.visit('/login') diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index c8c535a..9bc449b 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -2,12 +2,7 @@ "compilerOptions": { "target": "es5", "lib": ["es5", "dom"], - "types": ["cypress", "node"], - "paths": { - "#pages/*": [ - "../pages/*.ts" - ] - } + "types": ["cypress", "node"] }, "include": ["./**/*.ts"] } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 7e7bfab..3b37d60 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,10 @@ { "compilerOptions": { - "module": "ES2020", - "target": "ES2020", + "esModuleInterop": true, + "module": "nodenext", "lib": ["ES2022", "dom"], "strict": true, - "types": ["cypress", "node"], - "paths": { - "#pages/*": ["./cypress/pages/*"] - } + "types": ["cypress", "node"] }, "include": ["**/*.ts"], "exclude": ["node_modules"]