fix: e2e test coverage reporting (#6286)

* fix: e2e test coverage reporting

* fix: try increasing

* fix: names

* fix: optimize test.yml

* fix: undo last change and add cache
This commit is contained in:
eddie 2023-04-20 15:34:09 -07:00 committed by GitHub
parent 2268860615
commit 820e179560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 21 deletions

@ -85,6 +85,27 @@ jobs:
path: build path: build
if-no-files-found: error if-no-files-found: error
build-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: actions/cache@v3
id: build-e2e-cache
with:
path: node_modules/.cache
key: ${{ runner.os }}-build-e2e-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
restore-keys: ${{ runner.os }}-build-e2e-${{ hashFiles('**/yarn.lock') }}-
- run: yarn prepare
- run: yarn build:e2e
env:
NODE_OPTIONS: "--max_old_space_size=4096"
- uses: actions/upload-artifact@v2
with:
name: build-e2e
path: build
if-no-files-found: error
size-tests: size-tests:
needs: [build] needs: [build]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -99,7 +120,7 @@ jobs:
cypress-test-matrix: cypress-test-matrix:
needs: [build] needs: [build-e2e]
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: cypress/browsers:node-18.14.1-chrome-111.0.5563.64-1-ff-111.0-edge-111.0.1661.43-1 container: cypress/browsers:node-18.14.1-chrome-111.0.5563.64-1-ff-111.0-edge-111.0.1661.43-1
strategy: strategy:
@ -109,7 +130,6 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: ./.github/actions/setup - uses: ./.github/actions/setup
- uses: actions/cache@v3 - uses: actions/cache@v3
id: cypress-cache id: cypress-cache
with: with:
@ -121,7 +141,7 @@ jobs:
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:
name: build name: build-e2e
path: build path: build
- uses: cypress-io/github-action@v4 - uses: cypress-io/github-action@v4

7
.nycrc

@ -1,7 +0,0 @@
{
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"report-dir": "coverage",
"soureMap": false,
"instrument": false
}

@ -14,15 +14,30 @@ const shouldLintOrTypeCheck = !isProduction
module.exports = { module.exports = {
babel: { babel: {
plugins: ['@vanilla-extract/babel-plugin'], plugins: [
env: { '@vanilla-extract/babel-plugin',
test: { ...(process.env.REACT_APP_ADD_COVERAGE_INSTRUMENTATION
plugins: ['istanbul'], ? [
}, [
development: { 'istanbul',
plugins: ['istanbul'], {
}, all: true,
include: ['src/**/*.tsx', 'src/**/*.ts'],
exclude: [
'src/**/*.css',
'src/**/*.css.ts',
'src/**/*.test.ts',
'src/**/*.test.tsx',
'src/**/*.spec.ts',
'src/**/*.spec.tsx',
'src/**/graphql/**/*',
'src/**/*.d.ts',
],
}, },
],
]
: []),
],
}, },
eslint: { eslint: {
enable: shouldLintOrTypeCheck, enable: shouldLintOrTypeCheck,

@ -20,6 +20,7 @@
"postinstall": "patch-package", "postinstall": "patch-package",
"start": "craco start", "start": "craco start",
"build": "craco build", "build": "craco build",
"build:e2e": "REACT_APP_CSP_ALLOW_UNSAFE_EVAL=true REACT_APP_ADD_COVERAGE_INSTRUMENTATION=true craco build",
"analyze": "source-map-explorer 'build/static/js/*.js'", "analyze": "source-map-explorer 'build/static/js/*.js'",
"serve": "serve build -l 3000", "serve": "serve build -l 3000",
"lint": "yarn eslint --ignore-path .gitignore --cache --cache-location node_modules/.cache/eslint/ .", "lint": "yarn eslint --ignore-path .gitignore --cache --cache-location node_modules/.cache/eslint/ .",
@ -100,6 +101,7 @@
"@uniswap/eslint-config": "^1.1.1", "@uniswap/eslint-config": "^1.1.1",
"@vanilla-extract/babel-plugin": "^1.1.7", "@vanilla-extract/babel-plugin": "^1.1.7",
"@vanilla-extract/webpack-plugin": "^2.1.11", "@vanilla-extract/webpack-plugin": "^2.1.11",
"babel-plugin-istanbul": "^6.1.1",
"cypress": "10.3.1", "cypress": "10.3.1",
"cypress-hardhat": "^1.0.0", "cypress-hardhat": "^1.0.0",
"env-cmd": "^10.1.0", "env-cmd": "^10.1.0",
@ -190,7 +192,6 @@
"@web3-react/walletconnect": "^8.2.0", "@web3-react/walletconnect": "^8.2.0",
"array.prototype.flat": "^1.2.4", "array.prototype.flat": "^1.2.4",
"array.prototype.flatmap": "^1.2.4", "array.prototype.flatmap": "^1.2.4",
"babel-plugin-istanbul": "^6.1.1",
"cids": "^1.0.0", "cids": "^1.0.0",
"clsx": "^1.1.1", "clsx": "^1.1.1",
"copy-to-clipboard": "^3.2.0", "copy-to-clipboard": "^3.2.0",

@ -18,7 +18,11 @@
<meta name="theme-color" content="#FC72FF" /> <meta name="theme-color" content="#FC72FF" />
<meta <meta
http-equiv="Content-Security-Policy" http-equiv="Content-Security-Policy"
<% if (process.env.REACT_APP_CSP_ALLOW_UNSAFE_EVAL) { %>
content="script-src 'self' https://www.google-analytics.com https://www.googletagmanager.com 'unsafe-inline' 'unsafe-eval'"
<% } else { %>
content="script-src 'self' https://www.google-analytics.com https://www.googletagmanager.com 'unsafe-inline'" content="script-src 'self' https://www.google-analytics.com https://www.googletagmanager.com 'unsafe-inline'"
<% } %>
/> />
<!-- <!--