diff --git a/frontend/cypress.config.ts b/frontend/cypress.config.ts index 14d36fc74..4bdbd257d 100644 --- a/frontend/cypress.config.ts +++ b/frontend/cypress.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'cypress' +import { defineConfig } from 'cypress'; export default defineConfig({ projectId: 'ry4br7', @@ -12,12 +12,18 @@ export default defineConfig({ }, chromeWebSecurity: false, e2e: { - // We've imported your old cypress plugins here. - // You may want to clean this up later by importing these. - setupNodeEvents(on, config) { - return require('./cypress/plugins/index.js')(on, config) + setupNodeEvents(on: any, config: any) { + const fs = require('fs'); + const CONFIG_FILE = 'mempool-frontend-config.json'; + if (fs.existsSync(CONFIG_FILE)) { + let contents = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8')); + config.env.BASE_MODULE = contents.BASE_MODULE ? contents.BASE_MODULE : 'mempool'; + } else { + config.env.BASE_MODULE = 'mempool'; + } + return config; }, baseUrl: 'http://localhost:4200', specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', }, -}) +}); diff --git a/frontend/cypress/plugins/index.js b/frontend/cypress/plugins/index.js deleted file mode 100644 index 11f43df95..000000000 --- a/frontend/cypress/plugins/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const fs = require('fs'); - -const CONFIG_FILE = 'mempool-frontend-config.json'; - -module.exports = (on, config) => { - if (fs.existsSync(CONFIG_FILE)) { - let contents = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8')); - config.env.BASE_MODULE = contents.BASE_MODULE ? contents.BASE_MODULE : 'mempool'; - } else { - config.env.BASE_MODULE = 'mempool'; - } - return config; -}