diff --git a/.eslintrc.js b/.eslintrc.js index 5e88d5c..c0b771c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -37,8 +37,11 @@ module.exports = { '@typescript-eslint/explicit-member-accessibility': 'off', '@typescript-eslint/interface-name-prefix': 'off', '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-vars': 'off', // warns about mandatory param names in function types! + '@typescript-eslint/no-use-before-define': 'off', // pointless rule 'no-empty': 'warn', 'no-extra-boolean-cast': 'warn', + 'no-undef': 'off', // gives false alarms about Cypress globals e.g. JQuery 'prettier/prettier': ['error', {singleQuote: true, trailingComma: 'es5'}], 'react/prop-types': 'off' }, diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 0000000..61a69be --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from 'cypress'; + +export default defineConfig({ + component: { + devServer: { + framework: 'react', + bundler: 'webpack', + }, + specPattern: 'cypress/component/**/*.cy.{js,ts,jsx,tsx}', + video: false, + viewportWidth: 640, + viewportHeight: 480, + }, +}); diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 0199aa0..0000000 --- a/cypress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "component": { - "viewportWidth": 640, - "viewportHeight": 480, - "testFiles": "**/*.spec.{js,ts,jsx,tsx}", - "componentFolder": "cypress/component" - } -} diff --git a/cypress/component/commands/clear.spec.jsx b/cypress/component/commands/clear.cy.jsx similarity index 90% rename from cypress/component/commands/clear.spec.jsx rename to cypress/component/commands/clear.cy.jsx index 44ef869..6faab3b 100644 --- a/cypress/component/commands/clear.spec.jsx +++ b/cypress/component/commands/clear.cy.jsx @@ -8,11 +8,10 @@ import { import * as comp from '../../../src/components'; import eventually from '../../support/eventually'; -import mount from '../../support/mount'; describe('cy.clear', () => { it('clears Input', () => { - mount( + cy.mount( @@ -26,15 +25,13 @@ describe('cy.clear', () => { }); it('clears DateInput', () => { - mount( + cy.mount( ); - cy.get('input') - .focus() - .type('04/02/2018{enter}'); + cy.get('input').focus().type('04/02/2018{enter}'); cy.get('div[aria-haspopup="true"]').should( 'have.attr', 'aria-expanded', @@ -52,17 +49,17 @@ describe('cy.clear', () => { context('Select component', () => { it('clears values', () => { - const options = ['alpha', 'bravo', 'charlie'].map(o => ({ + const options = ['alpha', 'bravo', 'charlie'].map((o) => ({ label: o, value: o, })); let selected; - const onChange = o => { + const onChange = (o) => { selected = o && o.value; }; - mount( + cy.mount( diff --git a/cypress/component/commands/component.spec.jsx b/cypress/component/commands/component.cy.jsx similarity index 95% rename from cypress/component/commands/component.spec.jsx rename to cypress/component/commands/component.cy.jsx index f13748b..ddec3ec 100644 --- a/cypress/component/commands/component.spec.jsx +++ b/cypress/component/commands/component.cy.jsx @@ -11,7 +11,6 @@ import { NavLink, } from '@appfolio/react-gears'; -import mount from '../../support/mount'; import * as comp from '../../../src/components'; import { component as rawComponent } from '../../../src/commands/component'; @@ -25,7 +24,7 @@ function Timed({ children, init = false, dt = 2000 }) { describe('cy.component', () => { context('basics', () => { beforeEach(() => { - mount( + cy.mount( <>