From 8d1b7c2a5fb106add706d14e0a5fce3720323270 Mon Sep 17 00:00:00 2001 From: pivi Date: Tue, 17 Oct 2023 15:55:21 +0200 Subject: [PATCH] Add CY TS Config --- cypress/component/integration/Balance.cy.tsx | 1 - cypress/component/unit/truncate.cy.tsx | 2 +- cypress/support/component.ts | 7 +++++++ cypress/tsconfig.json | 9 +++++++++ package-lock.json | 2 +- package.json | 2 +- tsconfig.json | 4 +--- 7 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 cypress/tsconfig.json diff --git a/cypress/component/integration/Balance.cy.tsx b/cypress/component/integration/Balance.cy.tsx index b3c4ce52..4712c8ce 100644 --- a/cypress/component/integration/Balance.cy.tsx +++ b/cypress/component/integration/Balance.cy.tsx @@ -1,5 +1,4 @@ import '../../../src/global.css'; -import React from 'react'; import { Balance } from '../../../src/components'; import { compareSnapshot } from '../../compareSnapshot'; diff --git a/cypress/component/unit/truncate.cy.tsx b/cypress/component/unit/truncate.cy.tsx index 9e000bb2..976ec515 100644 --- a/cypress/component/unit/truncate.cy.tsx +++ b/cypress/component/unit/truncate.cy.tsx @@ -5,7 +5,7 @@ import { truncate } from '../../../src/util/truncate'; describe('Component | Unit | Util | Truncate', () => { before(() => { // check if the import worked correctly - expect(truncate, 'truncate').to.be.a('function'); + expect(truncate).to.be.a('function'); }); context('truncate', function () { diff --git a/cypress/support/component.ts b/cypress/support/component.ts index 017fdd16..fb8ea0b1 100644 --- a/cypress/support/component.ts +++ b/cypress/support/component.ts @@ -20,9 +20,16 @@ import './commands'; // Alternatively you can use CommonJS syntax: // require('./commands') +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore import { mount } from 'cypress/react18'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore import compareSnapshotCommand from 'cypress-image-diff-js/dist/command'; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore import { RecurseDefaults } from 'cypress-recurse'; // Augment the Cypress namespace to include type definitions for diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json new file mode 100644 index 00000000..bf234bfa --- /dev/null +++ b/cypress/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "target": "es6", + "lib": ["es6", "dom"], + "types": ["cypress", "node"], + "esModuleInterop": true + }, + "include": ["**/*.ts", "./cypress.d.ts"] +} diff --git a/package-lock.json b/package-lock.json index 7394ef38..6306c4d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -65,7 +65,7 @@ "react-test-renderer": "^18.2.0", "storybook": "^7.4.5", "tailwindcss": "^3.3.1", - "typescript": "^5.0.2", + "typescript": "^5.2.2", "vite": "^4.3.0" } }, diff --git a/package.json b/package.json index 5d69c17e..7c3fdbf8 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "react-test-renderer": "^18.2.0", "storybook": "^7.4.5", "tailwindcss": "^3.3.1", - "typescript": "^5.0.2", + "typescript": "^5.2.2", "vite": "^4.3.0" } } diff --git a/tsconfig.json b/tsconfig.json index 9f9f0ad3..85f3f678 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,6 @@ "module": "ESNext", "skipLibCheck": true, - /* Bundler mode */ "moduleResolution": "node", "allowSyntheticDefaultImports": true, "resolveJsonModule": true, @@ -13,12 +12,11 @@ "noEmit": true, "jsx": "react-jsx", - /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true }, - "include": ["src"], + "include": ["src", "cypress"], "references": [{ "path": "./tsconfig.node.json" }] }