1
0
Fork 0
mirror of https://codeberg.org/beerbrawl/beerbrawl.git synced 2024-09-22 21:20:52 +02:00

chore(#136): e2e: fix coverage reporting

Signed-off-by: Christoph Heiss <e11907069@student.tuwien.ac.at>
This commit is contained in:
Christoph Heiss 2024-06-25 21:58:00 +02:00
parent 9710a2d52f
commit 3552218e4a
Signed by: c8h4
GPG key ID: 73D5E7FDEE3DE49A
5 changed files with 26 additions and 25 deletions

View file

@ -58,6 +58,7 @@ test-and-build-frontend:
- npm run test:ci - npm run test:ci
- npm run build - npm run build
- npm run openapi-clients:replace-base-path-for-prod - npm run openapi-clients:replace-base-path-for-prod
coverage: /^Statements\s*:\s*([^%]+)/
artifacts: artifacts:
paths: paths:
- frontend/dist - frontend/dist
@ -76,8 +77,9 @@ e2e-test:
- sleep 30 - sleep 30
- cd ../e2e - cd ../e2e
- npm ci - npm ci
- npm run cypress - npm run cypress:ci
- npm run coverage:ci - npm run coverage:ci
coverage: /^Statements\s*:\s*([^%]+)/
artifacts: artifacts:
when: always when: always
expire_in: 1 hour expire_in: 1 hour

21
e2e/cypress.config.ci.js Normal file
View file

@ -0,0 +1,21 @@
const { defineConfig } = require('cypress');
module.exports = defineConfig({
reporter: 'cypress-multi-reporters',
reporterOptions: {
configFile: 'cypress/reporter-config.json',
},
watchForFileChanges: false,
viewportWidth: 1920,
viewportHeight: 1080,
e2e: {
specPattern: 'instrumented/e2e/**/*.cy.{js,jsx,ts,tsx}',
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config);
return config;
},
baseUrl: 'http://localhost:4200/',
},
});

View file

@ -13,7 +13,6 @@ module.exports = defineConfig({
// You may want to clean this up later by importing these. // You may want to clean this up later by importing these.
setupNodeEvents(on, config) { setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config); require('@cypress/code-coverage/task')(on, config);
require('./cypress/plugins/index.js')(on, config);
return config; return config;
}, },
baseUrl: 'http://localhost:4200/', baseUrl: 'http://localhost:4200/',

View file

@ -1,22 +0,0 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};

View file

@ -19,10 +19,11 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"cypress": "cypress run", "cypress": "cypress run",
"cypress:ci": "nyc instrument --compact=false cypress instrumented && cypress run --config-file cypress.config.ci.js",
"cypress:open": "cypress open", "cypress:open": "cypress open",
"prettier:check": "prettier --check '**/*.{json,html,scss,ts,js}'", "prettier:check": "prettier --check '**/*.{json,html,scss,ts,js}'",
"prettier:fix": "prettier --write '**/*.{json,html,scss,ts,js}'", "prettier:fix": "prettier --write '**/*.{json,html,scss,ts,js}'",
"coverage:ci": "nyc report --reporter=text-summary -t coverage --report-dir coverage/summary" "coverage:ci": "nyc report --reporter=text-summary"
}, },
"author": "Heimo Stranner", "author": "Heimo Stranner",
"license": "ISC" "license": "ISC"