Check types when running Cypress (#1186)
This commit is contained in:
parent
2237ee4d65
commit
c9f9a9b0c5
4 changed files with 6186 additions and 354 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
// The Webpack preprocessor does not include any types so it will have to be ignored.
|
||||||
|
// @ts-ignore
|
||||||
|
import webpackPreprocessor from "@cypress/webpack-batteries-included-preprocessor";
|
||||||
|
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
// This example plugins/index.js can be used to load plugins
|
// This example plugins/index.js can be used to load plugins
|
||||||
//
|
//
|
||||||
|
@ -11,10 +17,25 @@
|
||||||
// This function is called when a project is opened or re-opened (e.g. due to
|
// This function is called when a project is opened or re-opened (e.g. due to
|
||||||
// the project's config changing)
|
// the project's config changing)
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
const configurePlugins: Cypress.PluginConfig = (on) => {
|
||||||
const configurePlugins: Cypress.PluginConfig = (on, config) => {
|
const defaultOptions = webpackPreprocessor.defaultOptions.webpackOptions;
|
||||||
// `on` is used to hook into various events Cypress emits
|
const webpackOptions = {
|
||||||
// `config` is the resolved Cypress config
|
...defaultOptions,
|
||||||
|
context: path.resolve(__dirname, ".."),
|
||||||
|
plugins: [
|
||||||
|
new ForkTsCheckerWebpackPlugin({
|
||||||
|
async: false,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
on(
|
||||||
|
"file:preprocessor",
|
||||||
|
webpackPreprocessor({
|
||||||
|
typescript: require.resolve("typescript"),
|
||||||
|
webpackOptions,
|
||||||
|
})
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default configurePlugins;
|
export default configurePlugins;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"include": ["**/*"],
|
"include": ["**/*"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"types": ["cypress", "@testing-library/cypress"],
|
"types": ["node", "cypress", "@testing-library/cypress"],
|
||||||
"module": "ES2015",
|
"module": "ES2015",
|
||||||
"target": "ES2015",
|
"target": "ES2015",
|
||||||
}
|
}
|
||||||
|
|
6505
package-lock.json
generated
6505
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -45,6 +45,8 @@
|
||||||
"use-react-router-breadcrumbs": "^2.0.2"
|
"use-react-router-breadcrumbs": "^2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@cypress/webpack-batteries-included-preprocessor": "^2.2.3",
|
||||||
|
"@cypress/webpack-preprocessor": "^5.9.1",
|
||||||
"@jest/types": "^27.1.1",
|
"@jest/types": "^27.1.1",
|
||||||
"@snowpack/app-scripts-react": "^2.0.1",
|
"@snowpack/app-scripts-react": "^2.0.1",
|
||||||
"@snowpack/plugin-postcss": "^1.4.3",
|
"@snowpack/plugin-postcss": "^1.4.3",
|
||||||
|
@ -56,6 +58,7 @@
|
||||||
"@types/dagre": "^0.7.45",
|
"@types/dagre": "^0.7.45",
|
||||||
"@types/file-saver": "^2.0.3",
|
"@types/file-saver": "^2.0.3",
|
||||||
"@types/lodash": "^4.14.173",
|
"@types/lodash": "^4.14.173",
|
||||||
|
"@types/node": "^16.9.2",
|
||||||
"@types/react": "^17.0.21",
|
"@types/react": "^17.0.21",
|
||||||
"@types/react-dom": "^17.0.9",
|
"@types/react-dom": "^17.0.9",
|
||||||
"@types/react-router-dom": "^5.1.9",
|
"@types/react-router-dom": "^5.1.9",
|
||||||
|
@ -70,6 +73,7 @@
|
||||||
"eslint-plugin-cypress": "^2.12.1",
|
"eslint-plugin-cypress": "^2.12.1",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"eslint-plugin-react": "^7.25.3",
|
"eslint-plugin-react": "^7.25.3",
|
||||||
|
"fork-ts-checker-webpack-plugin": "^6.3.3",
|
||||||
"http2-proxy": "^5.0.53",
|
"http2-proxy": "^5.0.53",
|
||||||
"husky": "^7.0.2",
|
"husky": "^7.0.2",
|
||||||
"jest": "^27.2.0",
|
"jest": "^27.2.0",
|
||||||
|
|
Loading…
Reference in a new issue