feat: enable TypeScript for Cypress (#48701)

* feat: enable TypeScript for Cypress

* fix: run both js and ts in workflow
This commit is contained in:
Sem Bauke
2022-12-10 16:12:42 +01:00
committed by GitHub
parent da7b5d1de2
commit 12fd5c4d32
6 changed files with 14 additions and 5 deletions

View File

@@ -60,7 +60,8 @@
"./tools/ui-components/tsconfig.json",
"./utils/tsconfig.json",
"./web/tsconfig.json",
"./curriculum-server/tsconfig.json"
"./curriculum-server/tsconfig.json",
"./cypress/tsconfig.json"
]
},
"extends": [

View File

@@ -72,9 +72,9 @@ jobs:
- browsers: electron
spec: cypress/e2e/default/learn/challenges/projects.js
- browsers: chrome
spec: cypress/e2e/default/**/*.js
spec: cypress/e2e/default/**/*.{js,ts}
- browsers: firefox
spec: cypress/e2e/default/**/*.js
spec: cypress/e2e/default/**/*.{js,ts}
services:
mongodb:
image: mongo:4.4

View File

@@ -8,7 +8,7 @@ module.exports = defineConfig({
projectId: 'ke77ns',
retries: 4,
chromeWebSecurity: false,
specPattern: 'cypress/e2e/**/*.js',
specPattern: ['cypress/e2e/**/*.js', 'cypress/e2e/**/*.ts'],
setupNodeEvents(on, config) {
config.env = config.env || {};
on('before:run', () => {

8
cypress/tsconfig.json Normal file
View File

@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"]
},
"include": ["e2e/**/*.ts"],
"extends": "../tsconfig-base.json"
}

View File

@@ -14,7 +14,7 @@
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"types": ["node", "jest", "@testing-library/jest-dom"]
"types": ["node", "jest", "@testing-library/jest-dom", "cypress"]
},
// since ts-node compiles ts on the fly and then uses node, it needs to
// compile the scripts to commonjs (or node will complain about the requires)