Skip to content

Conversation

@pczeglik-iohk
Copy link
Contributor

@pczeglik-iohk pczeglik-iohk commented Mar 22, 2024

Improve code coverage and clean-up output log for cardano package.

With this change we eliminate from outpu errors like this one 👇

Failed to collect coverage from /Users/piotrczeglik/Work/PROJECTS/LACE/lace/packages/cardano/src/wallet/util/calculate-deposit-reclaim.ts
ERROR: Invalid file coverage object, missing keys, found:data
STACK: Error: Invalid file coverage object, missing keys, found:data
    at assertValidObject (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/istanbul-lib-coverage/lib/file-coverage.js:36:15)
    at new FileCoverage (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/istanbul-lib-coverage/lib/file-coverage.js:78:9)
    at CoverageMap.addFileCoverage (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/istanbul-lib-coverage/lib/coverage-map.js:109:21)
    at /Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/@jest/reporters/build/CoverageReporter.js:279:33
    at async Promise.all (index 4)
    at CoverageReporter._addUntestedFiles (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/@jest/reporters/build/CoverageReporter.js:296:7)
    at CoverageReporter.onRunComplete (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/@jest/reporters/build/CoverageReporter.js:171:5)
    at ReporterDispatcher.onRunComplete (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/@jest/core/build/ReporterDispatcher.js:71:9)
    at TestScheduler.scheduleTests (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/@jest/core/build/TestScheduler.js:306:5)
    at runJest (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/@jest/core/build/runJest.js:367:19)
    at _run10000 (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/@jest/core/build/cli/index.js:343:7)
    at runCLI (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/@jest/core/build/cli/index.js:198:3)
    at Object.run (/Users/piotrczeglik/Work/PROJECTS/LACE/lace/node_modules/jest-cli/build/run.js:130:37)

as we have a bunch of files which are not imported in tests nor have a test:

    'src/wallet/lib/config.ts',
    'src/wallet/util/calculate-deposit-reclaim.ts',
    'src/wallet/lib/get-total-minimum-coins.ts',
    'src/wallet/lib/build-transaction-props.ts',
    'src/wallet/util/observable.ts',
    'src/wallet/lib/providers.ts',
    'src/wallet/lib/set-missing-coins.ts',
    'src/ui/components/Voting/CatalystRegisterStep.tsx',
    'src/wallet/lib/hardware-wallet.ts',
    'src/ui/components/Voting/CurrentCatalystFund.tsx',
    'src/ui/components/Voting/DownloadCatalystStep.tsx',
    'src/ui/components/Voting/VotingParticipation.tsx',
    'src/ui/components/Voting/CatalystScanStep.tsx',
    'src/ui/components/Voting/CatalystPinStep.tsx',
    'src/ui/components/Voting/WaitForNextFundCard.tsx',
    'src/ui/components/Voting/CatalystConfirmationStep.tsx'

This is what coveralls shows currently on main:

image

This is what coveralls shows after this change:

image

@pczeglik-iohk pczeglik-iohk requested review from a team as code owners March 22, 2024 18:40
'!src/ui/components/Voting/CatalystConfirmationStep.tsx'
],
setupFilesAfterEnv: ['./test/jest.setup.js', 'jest-canvas-mock'],
transform: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code has been moved to common createJestConfig file

@github-actions
Copy link

github-actions bot commented Mar 22, 2024

Allure report

allure-report-publisher generated test report!

smokeTests: ✅ test report for 00540f34

passed failed skipped flaky total result
Total 30 0 0 0 30

@coveralls
Copy link

coveralls commented Mar 22, 2024

Coverage Status

Changes unknown
when pulling 00540f3 on test/cardano-package-unit-test-improvements
into ** on main**.

@github-actions github-actions bot added the browser Changes to the browser application. label Mar 22, 2024
@github-actions github-actions bot added the ci CI related issues or pull requests. label Mar 25, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get rid of warnings like that 👇 in our pipelines:

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, actions/labeler@v4. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what we see in Checks Tab for each PR. Those message clouds are mostly related to deprecated actions.
image

@pczeglik-iohk pczeglik-iohk force-pushed the test/cardano-package-unit-test-improvements branch from 3f77e78 to 376037d Compare March 25, 2024 07:02
@github-actions github-actions bot added the staking Changes to the staking package. label Mar 25, 2024
@pczeglik-iohk pczeglik-iohk force-pushed the test/cardano-package-unit-test-improvements branch from 376037d to 00540f3 Compare March 25, 2024 07:11
@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@pczeglik-iohk pczeglik-iohk changed the title test(cardano): clean-up code coverage and output log Github Actions workflow improvements Mar 25, 2024
@pczeglik-iohk pczeglik-iohk merged commit 9dc0bd5 into main Mar 25, 2024
@pczeglik-iohk pczeglik-iohk deleted the test/cardano-package-unit-test-improvements branch March 25, 2024 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

browser Changes to the browser application. ci CI related issues or pull requests. staking Changes to the staking package.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants