diff --git a/package.json b/package.json index 688b502..70108a9 100644 --- a/package.json +++ b/package.json @@ -83,12 +83,12 @@ } }, "lint-staged": { - "*.ts": [ + "src/**/*.ts": [ "vue-cli-service lint --fix", "prettier --write", "git add" ], - "*.vue": [ + "src/**/*.vue": [ "vue-cli-service lint --fix", "stylelint", "prettier --write", diff --git a/tests/e2e/plugins/index.js b/tests/e2e/plugins/index.js index ae74253..958bf89 100644 --- a/tests/e2e/plugins/index.js +++ b/tests/e2e/plugins/index.js @@ -1,6 +1,26 @@ // https://docs.cypress.io/guides/guides/plugins-guide.html +/* eslint-disable import/no-extraneous-dependencies global-require */ +const webpack = require("@cypress/webpack-preprocessor"); module.exports = (on, config) => { + on("file:preprocessor", webpack({ + webpackOptions: { + resolve: { + extensions: [".ts", ".tsx", ".js"] + }, + module: { + rules: [ + { + test: /\.tsx?$/, + loader: "ts-loader", + options: { transpileOnly: false } + } + ] + } + }, + watchOptions: {} + })); + return Object.assign({}, config, { fixturesFolder: "tests/e2e/fixtures", integrationFolder: "tests/e2e/specs", diff --git a/tests/e2e/specs/test.js b/tests/e2e/specs/test.ts similarity index 87% rename from tests/e2e/specs/test.js rename to tests/e2e/specs/test.ts index c9a96b4..e786e7e 100644 --- a/tests/e2e/specs/test.js +++ b/tests/e2e/specs/test.ts @@ -1,4 +1,5 @@ // https://docs.cypress.io/api/introduction/api.html +/// describe("My First Test", () => { it("Visits the app root url", () => { diff --git a/tests/e2e/tsconfig.json b/tests/e2e/tsconfig.json new file mode 100644 index 0000000..d416f4e --- /dev/null +++ b/tests/e2e/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["es5", "dom"], + "baseUrl": " ../../node_modules", + "types": ["cypress"] + }, + "include": [ + "**/*.ts" + ] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 9ba7c82..c6d59e2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -47,6 +47,7 @@ }, "exclude": [ "node_modules", - "build" + "build", + "tests/e2e" ] } diff --git a/vue.config.js b/vue.config.js index dc3fc2a..ab559ac 100644 --- a/vue.config.js +++ b/vue.config.js @@ -33,18 +33,20 @@ module.exports = { .when(process.env.NODE_ENV === "production", config => { // Use a runtime chunk to optimize cache busting. // Otherwise, the runtime information would be added to the entry point. - config - .optimization - .runtimeChunk({ name: "runtime" }); + if (!process.env.CYPRESS_ENV) { + config + .optimization + .runtimeChunk({ name: "runtime" }); + } - // Configure path alias for rxjs. - const rxPaths = require("rxjs/_esm2015/path-mapping"); - const rxResolvedPaths = rxPaths(); - for (const p in rxResolvedPaths) { - if (rxResolvedPaths.hasOwnProperty(p)) { - config.resolve.alias.set(p, rxResolvedPaths[p]); - } + // Configure path alias for rxjs. + const rxPaths = require("rxjs/_esm2015/path-mapping"); + const rxResolvedPaths = rxPaths(); + for (const p in rxResolvedPaths) { + if (rxResolvedPaths.hasOwnProperty(p)) { + config.resolve.alias.set(p, rxResolvedPaths[p]); } + } // Configure style purging. const purgeOptions = {