diff --git a/packages/grafana-e2e/cypress/plugins/typescriptPreprocessor.js b/packages/grafana-e2e/cypress/plugins/typescriptPreprocessor.js index 352b660a1a0..e187e63c8d6 100644 --- a/packages/grafana-e2e/cypress/plugins/typescriptPreprocessor.js +++ b/packages/grafana-e2e/cypress/plugins/typescriptPreprocessor.js @@ -1,9 +1,23 @@ +const { resolve } = require('path'); const wp = require('@cypress/webpack-preprocessor'); +const anyNodeModules = /node_modules/; +const packageRoot = resolve(`${__dirname}/../../`); +const packageModules = `${packageRoot}/node_modules`; + const webpackOptions = { module: { rules: [ { + include: modulePath => { + if (!anyNodeModules.test(modulePath)) { + // Is a file within the project + return true; + } else { + // Is a file within this package + return modulePath.startsWith(packageRoot) && !modulePath.startsWith(packageModules); + } + }, test: /\.ts$/, use: [ { diff --git a/packages/grafana-e2e/cypress/tsconfig.json b/packages/grafana-e2e/cypress/tsconfig.json index c5d0b72aed0..347c670a6a7 100644 --- a/packages/grafana-e2e/cypress/tsconfig.json +++ b/packages/grafana-e2e/cypress/tsconfig.json @@ -1,7 +1,9 @@ { "compilerOptions": { + "declaration": false, + "module": "commonjs", "types": ["cypress"] }, - "extends": "../tsconfig.json", + "extends": "@grafana/tsconfig", "include": ["**/*.ts"] }