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

[vrotest,vrotsc] (#461) Configurable unit tests setup #465

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

pboychev-bcom
Copy link

@pboychev-bcom pboychev-bcom commented Oct 31, 2024

NOTE:
Will update the description later. Opening the PR for early peer reviews.

Description

Checklist

  • I have added relevant error handling and logging messages to help troubleshooting
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation, relevant usage information (if applicable)
  • I have updated the PR title with affected component, related issue number and a short summary of the changes introduced
  • I have added labels for implementation kind (kind/) and version type (version/)
  • I have tested against live environment, if applicable
  • I have synced any structure and/or content vRA-NG improvements with vra-ng and ts-vra-ng archetypes (if applicable)
  • I have my changes rebased and squashed to the minimal number of relevant commits. Notice: don't squash all commits
  • I have added a descriptive commit message with a short title, including a Fixed #XXX - or Closed #XXX - prefix to auto-close the issue

Testing

Release Notes

Related issues and PRs

@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@github-actions github-actions bot added the kind/feature New Feature to the project label Oct 31, 2024
const setupFramework = hasCustomTestsConfig
? undefined
: (
flags.testFrameworkPackage === "jest"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was wondering whether it is worth converting this logic to a switch case and putting it in a function so that it is easier to extend down the line if we introduce more frameworks.
that being said, I don't think that we will introduce another test framework soon

Copy link
Author

Choose a reason for hiding this comment

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

Or even better we could convert that to a factory. I was thinking of changing this to a factory either way so I could definitely do that, I didn't because I can't see introducing support for another framework as well and don't want to add more complexity to the code if not necessary... So I would appreciate your point of view as well and we can apply changes as we decide collectively :)

@VenelinBakalov VenelinBakalov added version/minor Introduces a non-breaking feature or change area/tests Relates to tests and code coverage area/build Relates to the build process and removed dco-required labels Nov 1, 2024
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

Co-authored-by: Venelin Bakalov <[email protected]>
Signed-off-by: Plamen Boychev <[email protected]>
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

Added the required missing "projectRoot" parameter.
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@pboychev-bcom, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@Michaelpalacce
Copy link
Collaborator

Take a look at: https://github.com/vmware/build-tools-for-vmware-aria/blob/main/typescript/vrotsc/src/compiler/transformer/fileTransformers/test.ts

there is a transformer validateJasmineTest. The transformer is used only to collect diagnostics, no code changes are done here, so we are good. A few changes are needed tho:

  1. Name change
  2. Error message change
  3. validation of describe. Currently this is the validation code that matters:
		if (callArgs.length !== 2) {
			return false;
		}

		if (callArgs[0].kind !== ts.SyntaxKind.StringLiteral) {
			return false;
		}

		if (callArgs[1].kind !== ts.SyntaxKind.ArrowFunction && callArgs[1].kind !== ts.SyntaxKind.FunctionExpression) {
			return false;
		}

The first will check if the "describe" has exactly 2 arguments, I believe this should be changed to 2 or more, as that's a possibility in jasmine.

The other 2 validate the inputs, these seem ok, as long as the major frameworks agree on the standard.

@Michaelpalacce
Copy link
Collaborator

Instead of having jasmine-bootstrapper and jest-bootstrapper, we can use template folders.

The template folders should be put outside of the src folder so they are not compiled.
The Gulpfile.ts should be modified. The task bundle needs to be changed so that after adding the compiled vrotest.js file, it also copies over the folder with the templates for jest and jasmine

@Michaelpalacce
Copy link
Collaborator

I wonder if we can go without the logic of specifying the versions, of the different libraries and dependencies, in the pom.xml? Could be handled by the user

@Michaelpalacce Michaelpalacce changed the title Feature/461 configurable unit tests setup [vrotest,vrotsc] (#461) Configurable unit tests setup Nov 12, 2024
@Michaelpalacce
Copy link
Collaborator

Take a look at docs/versions/latest/Release.md -> We put the changes for the current version here, so you can add some documentation if needed. You can explain the upgrade path if needed.

Also, the documentation over here:

image

May need updating with whatever you have in the vrotest's README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Relates to the build process area/tests Relates to tests and code coverage dco-required kind/feature New Feature to the project version/minor Introduces a non-breaking feature or change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants