Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test coverage support through CodeCov #3281

Merged
merged 4 commits into from
Jan 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Report coverage from cypress tests (#92)
Signed-off-by: Guilherme Caponetto <638737+caponetto@users.noreply.github.com>
caponetto committed Jan 16, 2025
commit 2ed0142717f190c102f65c4df436c66436196c78
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -181,13 +181,18 @@ jobs:
run: |
make build-dependencies
make yarn-install
make test-instrument
make build-ui-prod
- name: Install
run: |
make install-server
make install-examples
- name: Cypress
run: make test-integration
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage/cobertura-coverage.xml
- name: Collect logs
uses: actions/upload-artifact@v4
if: failure()
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ nosetests.xml
coverage.xml
*,cover
**/coverage/
.nyc_output/

# Translations
*.mo
12 changes: 12 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "nyc-config-tsx",
"all": true,
"include": ["**/src/**/*.{ts,tsx}"],
"exclude": ["**/*.spec.ts", "tests/**/*"],
"reporter": ["text-summary", "cobertura"],
"check-coverage": true,
"lines": 70,
"functions": 60,
"branches": 50,
"statements": 70
}
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -217,6 +217,9 @@ test-server: test-dependencies pytest # Run python unit tests
test-ui-unit: # Run frontend jest unit tests
yarn test:unit

test-instrument: # Prepare code coverage instrumentation
yarn lerna run cy:instrument --stream

test-integration: # Run frontend cypress integration tests
jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
yarn test:integration
3 changes: 3 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@
* limitations under the License.
*/

import coverage from '@cypress/code-coverage/task';

import { defineConfig } from 'cypress';

import { register } from './cypress/utils/snapshots/plugin';
@@ -33,6 +35,7 @@ export default defineConfig({
testIsolation: false,
setupNodeEvents(on, config) {
register(on, config);
coverage(on, config);
return config;
},
retries: {
2 changes: 2 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@
* limitations under the License.
*/

import '@cypress/code-coverage/support';

import '@testing-library/cypress/add-commands';

import 'cypress-real-events/support';
1 change: 1 addition & 0 deletions cypress/support/index.d.ts
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface Chainable {
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
"scripts": {
"graph": "ts-node etc/scripts/generate-make-graph.ts",
"cy:open": "npx cypress open",
"cy:run": "npx cypress run --headed",
"cy:run": "npx nyc npx cypress run --headed",
"eslint": "eslint . --fix --ignore-path .gitignore --ext .ts,.tsx,.js",
"eslint:check": "eslint . --ignore-path .gitignore --ext .ts,.tsx,.js",
"prettier": "prettier --ignore-path .gitignore --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json}\"",
@@ -44,6 +44,7 @@
"yjs": "^13.5.40"
},
"devDependencies": {
"@cypress/code-coverage": "^3.13.8",
"@cypress/webpack-preprocessor": "^6.0.2",
"@glen/jest-raw-loader": "^2.0.0",
"@jupyterlab/testutils": "^4.2.5",
@@ -72,6 +73,8 @@
"lerna": "^8.0.1",
"lint-staged": "^15.2.0",
"npm-run-all": "^4.1.5",
"nyc": "^17.1.0",
"nyc-config-tsx": "^0.1.0",
"prettier": "^3.1.1",
"rimraf": "~5.0.5",
"start-server-and-test": "^2.0.3",
1 change: 1 addition & 0 deletions packages/code-snippet/package.json
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_code_snippet_extension/labextension ../../../../labextensions/elyra_code_snippet_extension/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/code-viewer/package.json
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_code_viewer_extension/labextension ../../../../labextensions/elyra_code_viewer_extension/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/metadata-common/package.json
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_metadata_common/labextension ../../../../labextensions/elyra_metadata_common/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/metadata/package.json
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_metadata_extension/labextension ../../../../labextensions/elyra_metadata_extension/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/pipeline-editor/package.json
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_pipeline_editor_extension/labextension ../../../../labextensions/elyra_pipeline_editor_extension/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/python-editor/package.json
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_python_editor_extension/labextension ../../../../labextensions/elyra_python_editor_extension/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/r-editor/package.json
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_r_editor_extension/labextension ../../../../labextensions/elyra_r_editor_extension/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/scala-editor/package.json
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_scala_editor_extension/labextension ../../../../labextensions/elyra_scala_editor_extension/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/script-debugger/package.json
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_script_debugger_extension/labextension ../../../../labextensions/elyra_script_debugger_extension/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/script-editor/package.json
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_script_editor/labextension ../../../../labextensions/elyra_script_editor/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/services/package.json
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_services/labextension ../../../../labextensions/elyra_services/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/theme/package.json
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensionselyra_theme_extension/labextension ../../../../labextensionselyra_theme_extension/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
1 change: 1 addition & 0 deletions packages/ui-components/package.json
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf ../../../../labextensions/elyra_ui_components/labextension ../../../../labextensions/elyra_ui_components/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"cy:instrument": "npx nyc instrument --compact=false --in-place src/ src/",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

/* Additional Checks */
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noFallthroughCasesInSwitch": false,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,

326 changes: 307 additions & 19 deletions yarn.lock

Large diffs are not rendered by default.