Skip to content

Commit

Permalink
feat(testing): set transpileOnly=true ...
Browse files Browse the repository at this point in the history
... and use the ForkTsCheckerWebpackPlugin
for the cypress test execution.

Closes nrwl#1871
  • Loading branch information
skydever authored and Doginal committed Oct 30, 2019
1 parent 074996a commit dd3fc99
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@angular-devkit/architect": "0.803.3",
"@angular-devkit/core": "8.3.3",
"@cypress/webpack-preprocessor": "~4.1.0",
"fork-ts-checker-webpack-plugin": "^0.4.9",
"tree-kill": "1.2.1",
"ts-loader": "5.3.1",
"tsconfig-paths-webpack-plugin": "3.2.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/cypress/src/plugins/preprocessor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ describe('getWebpackConfig', () => {
options: {
configFile: './tsconfig.json',
// https://github.com/TypeStrong/ts-loader/pull/685
experimentalWatchApi: true
experimentalWatchApi: true,
// https://github.com/cypress-io/cypress/issues/2316
transpileOnly: true
}
});
});
Expand Down
11 changes: 10 additions & 1 deletion packages/cypress/src/plugins/preprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as wp from '@cypress/webpack-preprocessor';
import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin';
import * as nodeExternals from 'webpack-node-externals';

import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

export function preprocessTypescript(config: any) {
if (!config.env.tsConfig) {
throw new Error(
Expand Down Expand Up @@ -35,11 +37,18 @@ export function getWebpackConfig(config: any) {
options: {
configFile: config.env.tsConfig,
// https://github.com/TypeStrong/ts-loader/pull/685
experimentalWatchApi: true
experimentalWatchApi: true,
// https://github.com/cypress-io/cypress/issues/2316
transpileOnly: true
}
}
]
},
plugins: [
new ForkTsCheckerWebpackPlugin({
tsconfig: config.env.tsConfig
})
],
externals: [nodeExternals()]
};
}

0 comments on commit dd3fc99

Please sign in to comment.