From 4b01ff5f67ce9e99425d4fbc673c9066abbf47b7 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sun, 20 Aug 2023 20:03:00 +0200 Subject: [PATCH] ci: add cypress coverage Signed-off-by: Philip Molares --- frontend/.gitignore | 1 + frontend/cypress.config.ts | 8 ++++++-- frontend/cypress/support/e2e.ts | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/.gitignore b/frontend/.gitignore index 008a54848..04e70bf7f 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -11,6 +11,7 @@ # testing /coverage +/.nyc_output # downloaded files during tests with cypress /cypress/downloads diff --git a/frontend/cypress.config.ts b/frontend/cypress.config.ts index 02868d3cd..af92267b4 100644 --- a/frontend/cypress.config.ts +++ b/frontend/cypress.config.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -13,6 +13,10 @@ export default defineConfig({ e2e: { baseUrl: 'http://127.0.0.1:3001/', - specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}' + specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', + setupNodeEvents(on, config) { + require('@cypress/code-coverage/task')(on, config) + return config + }, } }) diff --git a/frontend/cypress/support/e2e.ts b/frontend/cypress/support/e2e.ts index a6d2acdd4..386392def 100644 --- a/frontend/cypress/support/e2e.ts +++ b/frontend/cypress/support/e2e.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -26,3 +26,4 @@ import './logout' import './visit' import './visit-test-editor' import 'cypress-commands' +import '@cypress/code-coverage/support'