Skip to content

Commit

Permalink
build: preprocess cypress files
Browse files Browse the repository at this point in the history
  • Loading branch information
timdeschryver committed Feb 18, 2019
1 parent 332d098 commit 8ae62c7
Show file tree
Hide file tree
Showing 6 changed files with 832 additions and 11 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"example:cypress:open": "cypress open --project=projects/example-app-cypress",
"example:cypress:run": "cypress run --project=projects/example-app-cypress",
"example:cypress:ci": "npm-run-all --parallel --race example:server \"example:cypress:run -- --config=baseUrl=http://localhost:4000\"",
"example:build":"yarn cli build --prod",
"example:build": "yarn cli build --prod",
"example:build:prod": "yarn example:build -- --base-href \"/platform/example-app/\"",
"ci": "yarn run test && nyc report --reporter=text-lcov | coveralls",
"example:server": "node build/example-app-server",
Expand Down Expand Up @@ -97,6 +97,7 @@
"devDependencies": {
"@angular-devkit/build-angular": "^0.10.0",
"@bazel/bazel": "^0.19.1",
"@cypress/webpack-preprocessor": "^4.0.3",
"@octokit/rest": "^15.17.0",
"@types/fs-extra": "^2.1.0",
"@types/glob": "^5.0.33",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="Cypress" />

context('Full round trip', () => {
before(() => {
window.indexedDB.deleteDatabase('books_app');
Expand Down
26 changes: 26 additions & 0 deletions projects/example-app-cypress/plugins/cy-ts-preprocessor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const wp = require('@cypress/webpack-preprocessor');

const webpackOptions = {
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: [/node_modules/],
use: [
{
loader: 'ts-loader',
},
],
},
],
},
};

const options = {
webpackOptions,
};

module.exports = wp(options);
6 changes: 5 additions & 1 deletion projects/example-app-cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
module.exports = on => {};
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor');

module.exports = on => {
on('file:preprocessor', cypressTypeScriptPreprocessor);
};
13 changes: 13 additions & 0 deletions projects/example-app-cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"strict": true,
"baseUrl": "../../node_modules",
"target": "es5",
"experimentalDecorators": true,
"skipLibCheck": true,
"noImplicitAny": false,
"lib": ["es6", "dom"],
"types": ["cypress"]
},
"include": ["**/*.ts"]
}
Loading

0 comments on commit 8ae62c7

Please sign in to comment.