Skip to content

Commit

Permalink
feat: [PIE-1380]: Cypress fix (#5505)
Browse files Browse the repository at this point in the history
* feat: [PIE-1380]: Fixes some cypress code coverages

* feat: [PIE-1380]: Fixes some cypress code coverages

* feat: [PIE-1380]: Fixes some cypress code coverages

* feat: [PIE-1380]: Fixes some cypress code coverages

* feat: [PIE-1380]: Fixes some cypress code coverages
  • Loading branch information
Kapil Kumawat authored Sep 27, 2021
1 parent 8c5cd88 commit c8f1612
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 178 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ You can use the following comments to re-trigger PR Checks
- Title Check: `retrigger titlecheck`
- Coverage: `retrigger coverage`
- Rebase: `trigger rebase`
- Cypress: `trigger cypress`
- Fix Prettier - `fix prettier`
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ temp
.yalc/
yalc.lock
.env
junit.xml
junit.xml
cypress/videos/
13 changes: 13 additions & 0 deletions .nycrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends: '@istanbuljs/nyc-config-typescript'
all: true,
include:
- src/**/*.tsx
- src/**/*.ts
exclude:
- src/**/*.test.tsx
- src/**/*.test.ts
- src/**/*.d.ts
- src/**/__tests__/**
- src/**/__mocks__/**
- src/**/_stories/**
report-dir: cypress-coverage
4 changes: 3 additions & 1 deletion cypress/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
// eslint-disable-next-line no-unused-vars
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor')
module.exports = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {
require('@cypress/code-coverage/task')(on, config)
if (process.env.CYPRESS_COVERAGE) {
require('@cypress/code-coverage/task')(on, config)
}
on('file:preprocessor', cypressTypeScriptPreprocessor)
return config
}
3 changes: 2 additions & 1 deletion harnessci.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14
FROM cypress/browsers:node14.16.0-chrome90-ff88
ARG GIT_BOT_TOKEN

WORKDIR /tmp/workspace
Expand All @@ -10,3 +10,4 @@ RUN echo @wings-software:registry=https://npm.pkg.github.com > .npmrc
RUN echo "//npm.pkg.github.com/:_authToken="$GIT_BOT_TOKEN >> .npmrc
RUN echo always-auth=true >> .npmrc
RUN yarn install
RUN npm install -g wait-on
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
"test:watch": "jest --watch",
"lint": "eslint --rulesdir ./scripts/eslint-rules --ext .ts --ext .tsx src",
"typecheck": "tsc",
"cypress:ci": "cypress run --config videoUploadOnPasses=false --browser chrome",
"cypress:open": "cypress open",
"cypress:openCoverage": "CYPRESS_COVERAGE=true cypress open",
"strings-check": "node ./scripts/yaml-strings-check.js",
"clean": "rm -rf dist && rm -rf node_modules/.cache",
"dev:cypress": "NODE_ENV=development TARGET_LOCALHOST=false CYPRESS=true BASE_URL=https://localhost:8080 webpack serve --progress",
"dev:cypress": "NODE_ENV=development TARGET_LOCALHOST=false CYPRESS=true BASE_URL=https://localhost:8080 NODE_OPTIONS=\"--max-old-space-size=6144\" webpack serve --progress",
"dev:cypressCoverage": "NODE_ENV=development TARGET_LOCALHOST=false CYPRESS=true CYPRESS_COVERAGE=true BASE_URL=https://localhost:8080 NODE_OPTIONS=\"--max-old-space-size=6144\" webpack serve --progress",
"dev": "NODE_ENV=development webpack serve --progress",
"watch": "yarn clean && NODE_ENV=development webpack --watch --progress",
"services": "npm-run-all services:*",
Expand Down Expand Up @@ -186,7 +189,7 @@
"case": "^1.6.3",
"circular-dependency-plugin": "^5.2.2",
"css-loader": "^5.2.1",
"cypress": "^8.1.0",
"cypress": "^8.4.1",
"dotenv": "^10.0.0",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
Expand Down Expand Up @@ -286,10 +289,5 @@
]
},
"commonChunkLimit": "70-pipeline"
},
"nyc": {
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"report-dir": "cypress-coverage"
}
}
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ON_PREM = `${process.env.ON_PREM}` === 'true'
const BUGSNAG_TOKEN = process.env.BUGSNAG_TOKEN
const BUGSNAG_SOURCEMAPS_UPLOAD = `${process.env.BUGSNAG_SOURCEMAPS_UPLOAD}` === 'true'
const CONTEXT = process.cwd()
const isCypressCoverage = process.env.CYPRESS_COVERAGE
const isCypress = process.env.CYPRESS
const babelLoaderConfig = {
loader: 'babel-loader'
Expand All @@ -34,7 +35,7 @@ const tsLoaderConfig = {
}
}
const tsLoaders = []
if (isCypress) {
if (isCypress && isCypressCoverage) {
tsLoaders.push(babelLoaderConfig)
tsLoaders.push(tsLoaderConfig)
} else {
Expand Down
Loading

0 comments on commit c8f1612

Please sign in to comment.