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

Initial setup of unit tests #311

Merged
merged 6 commits into from
Nov 5, 2024

Conversation

Achal1607
Copy link
Member

This PR introduces an initial setup for unit testing to help validate fixes more quickly, without the need for a full NetBeans environment and VS Code UI runs. This setup includes sample unit tests for JDKDownloaderView in view.ts and adds few development dependencies for testing and mocking. A few VS Code-related mocks are also included.

List of DevDependencies added and Justification:

  • @istanbuljs/nyc-config-typescript:
    A code coverage tool, with TypeScript support, ensuring code coverage reporting for TypeScript code.

  • @types/chai & chai:
    chai is a popular assertion library used for writing readable and expressive test assertions. @types/chai provides TypeScript definitions for chai.

  • @types/sinon & sinon:
    sinon is a library for creating mocks, spies, and stubs, useful for isolating and testing code components. @types/sinon provides TypeScript definitions.

  • ts-mockito:
    Provides a simpler API for creating mocks in TypeScript, offering an alternative to sinon for creating clean, readable mocks in TypeScript. Sinon doesn't have support for mocking interfaces and namesapce. So, it is also required.

  • vscode-uri:
    Used for handling and manipulating URIs in a way consistent with VS Code’s own URI utilities, especially useful for file and path manipulations within tests.

@Achal1607 Achal1607 added the do not merge Don't merge PR label Oct 29, 2024
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 29, 2024
Copy link
Member

@sid-srini sid-srini left a comment

Choose a reason for hiding this comment

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

Thanks a lot @Achal1607 for getting the unit tests framework added.

Please do rebase against main after merging #310.

  • That should remove many of the files/changes from the scope of this PR.
  • Some work maybe needed to incorporate the changes on newly added tests on main like the localisation tests.

Most of my comments are queries for clarification, with few minor code suggestions.

Thanks a lot.

patches/add-licences.diff Outdated Show resolved Hide resolved
build.xml Outdated Show resolved Hide resolved
patches/add-licences.diff Outdated Show resolved Hide resolved
vscode/package.json Outdated Show resolved Hide resolved
vscode/src/test/integration/constants.ts Outdated Show resolved Hide resolved
vscode/src/test/unit/mocks/vscode/charCode.ts Outdated Show resolved Hide resolved
vscode/src/test/unit/mocks/vscode/namespaces/window.ts Outdated Show resolved Hide resolved
vscode/src/test/unit/mocks/vscode/uri.ts Outdated Show resolved Hide resolved
vscode/src/test/unit/testUtils.ts Show resolved Hide resolved
@sid-srini sid-srini added this to the JVSC 23.0.1 milestone Oct 30, 2024
@Achal1607 Achal1607 force-pushed the initial-unit-tests-setup branch 4 times, most recently from 17cab36 to e1402de Compare November 4, 2024 09:58
@Achal1607 Achal1607 force-pushed the initial-unit-tests-setup branch 2 times, most recently from 7482c62 to c8a23a4 Compare November 5, 2024 04:59
Copy link
Member

@sid-srini sid-srini left a comment

Choose a reason for hiding this comment

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

Thanks a lot @Achal1607. LGTM 👍

@Achal1607 Achal1607 removed the do not merge Don't merge PR label Nov 5, 2024
@sid-srini sid-srini merged commit fe7bece into oracle:main Nov 5, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants