Skip to content

Commit

Permalink
refactor: Typescript setup
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKolega committed Aug 25, 2023
1 parent f76c088 commit 4085363
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 19 deletions.
8 changes: 8 additions & 0 deletions test/cypress/support/commands.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare namespace Cypress {
interface Chainable<Subject> {
loginFormCookie(url?: any, userObject?: any): Chainable<any>
registerRequest(username?: string, password?: string): Chainable<any>
loginRequest(username?: string, password?: string): Chainable<any>
loginUI(username?: string, password?: string): Chainable<any>
}
}
2 changes: 2 additions & 0 deletions test/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
///
//

Cypress.Commands.add(
"loginFormCookie",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import "./commands"

import "cypress-plugin-xhr-toggle"

// @ts-ignore
import registerCypressGrep from "@cypress/grep/src/support"
registerCypressGrep()

Expand Down
20 changes: 8 additions & 12 deletions test/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": "../",
"esModuleInterop": true,
"lib": ["ES2022", "DOM"],
"moduleResolution": "Node",
"noEmit": true,
"paths": {
"@cy-support/*": ["cypress/support/*"]
},
"strict": true,
"target": "ES2022",
"types": ["cypress", "vite", "node"]
"types": ["cypress", "node"]
},
"include": ["./**/*", "./vite.config.ts", "../cypress.config.ts", "../node_modules/cypress/**/*.*"]
"include": ["./**/*.*", "../node_modules/cypress/**/*.*"],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
9 changes: 9 additions & 0 deletions test/cypress/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ES2022",
"moduleResolution": "bundler"
},
"include": ["./vite.config.ts"]
}
18 changes: 18 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ES2022",
"moduleResolution": "Node",
"noEmit": true,
"paths": {
"@cy-support/*": ["./test/cypress/support/*"]
},
"resolveJsonModule": true,
"strict": true,
"target": "ES2022",
"types": ["node", "vite", "vue"]
},
"include": ["./**/*.*"]
}
8 changes: 1 addition & 7 deletions vue-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
Expand Down

0 comments on commit 4085363

Please sign in to comment.