From c9d995d44514fd05a945a15cd1606316d10d2c93 Mon Sep 17 00:00:00 2001 From: Claire Nord Date: Sun, 20 Aug 2023 21:53:31 -0700 Subject: [PATCH] cypress: tweak linter config See https://github.com/cypress-io/cypress/issues/26930 --- cypress/.eslintrc.js | 2 ++ cypress/support/commands.ts | 5 +---- cypress/support/index.js | 20 ++++++++++++++++++++ cypress/tsconfig.json | 1 - 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 cypress/support/index.js diff --git a/cypress/.eslintrc.js b/cypress/.eslintrc.js index 37c79ff0..4d04e430 100644 --- a/cypress/.eslintrc.js +++ b/cypress/.eslintrc.js @@ -1,6 +1,8 @@ +/** @type {import('eslint').Linter.Config} */ module.exports = { parserOptions: { tsconfigRootDir: __dirname, project: "./tsconfig.json", }, + ignorePatterns: ["*.js"], }; diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 56c4591d..fad258ef 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -21,12 +21,9 @@ declare global { // Also added custom types to avoid getting detached // https://github.com/cypress-io/cypress/issues/7306#issuecomment-1152752612 // =========================================================== -function visitAndCheck(url: string, waitTime: number = 1000) { +export function visitAndCheck(url: string, waitTime = 1000) { cy.visit(url); cy.location("pathname").should("contain", url).wait(waitTime); } Cypress.Commands.add("visitAndCheck", visitAndCheck); - -// Add an empty export so we can `declare global` above -export {}; diff --git a/cypress/support/index.js b/cypress/support/index.js new file mode 100644 index 00000000..d076cec9 --- /dev/null +++ b/cypress/support/index.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import "./commands"; + +// Alternatively you can use CommonJS syntax: +// require('./commands') diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index bf18936e..d5c78269 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -20,7 +20,6 @@ "strict": true, "skipLibCheck": true, "resolveJsonModule": true, - "typeRoots": ["../types", "../node_modules/@types"], "paths": { "~/*": ["../app/*"]