Commit 35dace7b authored by eddie's avatar eddie Committed by GitHub

feat: cypress test coverage reporting (#6212)

* wip

* fix: only instrument thru babel in test and dev

* fix: remove unused deps

* fix: yarn dedup

* fix: remove nyc_output dir from git

* fix: remove comment from index.html
parent 8ce8e17f
...@@ -113,6 +113,12 @@ jobs: ...@@ -113,6 +113,12 @@ jobs:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
# Included as a single job to check for cypress-test-matrix success, as a matrix cannot be checked. # Included as a single job to check for cypress-test-matrix success, as a matrix cannot be checked.
cypress-tests: cypress-tests:
if: ${{ always() }} if: ${{ always() }}
......
...@@ -29,6 +29,10 @@ schema.graphql ...@@ -29,6 +29,10 @@ schema.graphql
.env.test.local .env.test.local
.env.production.local .env.production.local
instrumented
.nyc_output
.nyc_output/**/*
/.netlify /.netlify
npm-debug.log* npm-debug.log*
......
{
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"report-dir": "coverage",
"soureMap": false,
"instrument": false
}
\ No newline at end of file
ignore:
- "**/generated/**/*"
- "**/generated/*"
- "**/cypress/**/*"
- "cypress/**/*"
- "**/instrumented/**/*"
- "**/styles/**/*"
- "styles/**/*"
- "**/constants/**/*"
- "constants/**/*"
coverage:
status:
project:
default:
target: auto
threshold: 5%
if_ci_failed: error
patch:
default:
enabled: no
if_not_found: success
\ No newline at end of file
...@@ -8,6 +8,14 @@ const commitHash = require('child_process').execSync('git rev-parse HEAD') ...@@ -8,6 +8,14 @@ const commitHash = require('child_process').execSync('git rev-parse HEAD')
module.exports = { module.exports = {
babel: { babel: {
plugins: ['@vanilla-extract/babel-plugin'], plugins: ['@vanilla-extract/babel-plugin'],
env: {
test: {
plugins: ['istanbul'],
},
development: {
plugins: ['istanbul'],
},
},
}, },
jest: { jest: {
configure(jestConfig) { configure(jestConfig) {
......
import codeCoverageTask from '@cypress/code-coverage/task'
import { defineConfig } from 'cypress' import { defineConfig } from 'cypress'
export default defineConfig({ export default defineConfig({
...@@ -7,6 +8,7 @@ export default defineConfig({ ...@@ -7,6 +8,7 @@ export default defineConfig({
chromeWebSecurity: false, chromeWebSecurity: false,
e2e: { e2e: {
setupNodeEvents(on, config) { setupNodeEvents(on, config) {
codeCoverageTask(on, config)
return { return {
...config, ...config,
// Only enable Chrome. // Only enable Chrome.
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
// Import commands.ts using ES2015 syntax: // Import commands.ts using ES2015 syntax:
import { injected } from './ethereum' import { injected } from './ethereum'
import assert = require('assert') import assert = require('assert')
import '@cypress/code-coverage/support'
import { FeatureFlag } from '../../src/featureFlags/flags/featureFlags' import { FeatureFlag } from '../../src/featureFlags/flags/featureFlags'
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment