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

chore(jest): setup jest for frontend #331

Merged
merged 4 commits into from
Oct 11, 2021

Conversation

bhavin-a
Copy link
Contributor

@bhavin-a bhavin-a commented Oct 3, 2021

Description

The PR sets up jest tests in the repo with support of custom matchers from React Testing library.

Closes #312

How to Test?

  1. Run cd ./frontend
  2. Run command yarn test
  3. This will run a sample test added for NotFound page.
  4. Run command yarn test:coverage
  5. This will run a sample test added for NotFound page along with coverage report which this test was able to capture.

@palashgdev palashgdev self-requested a review October 3, 2021 14:45
@palashgdev
Copy link
Contributor

Hi @Bhavin789
Thanks for your PR against the issue will review your PR by tomorrow

@bhavin-a
Copy link
Contributor Author

bhavin-a commented Oct 3, 2021

Sure @palash-signoz , whenever you are available 🙂.

@bhavin-a bhavin-a requested a review from palashgdev October 4, 2021 12:51
@palashgdev palashgdev added enhancement New feature or request frontend labels Oct 7, 2021
@palashgdev
Copy link
Contributor

Hi @Bhavin789

Please go through the suggestion which will help to review your PR

  1. change test script to jest
  2. Introduce a new script with key test:watch :jest --watch

@palashgdev
Copy link
Contributor

Hi @Bhavin789 please update the threads also

@bhavin-a
Copy link
Contributor Author

bhavin-a commented Oct 7, 2021

Hi @Bhavin789 please update the threads also

@pal-sig Have updated the threads and resolved all except for the removal of cypress from root tsconfig. Can you please help confirm if that is ok? Thanks!

@bhavin-a bhavin-a changed the title chore: setup jest chore(jest): setup jest for frontend Oct 7, 2021
@palashgdev
Copy link
Contributor

Hi @Bhavin789 please update the threads also

@pal-sig Have updated the threads and resolved all except for the removal of cypress from root tsconfig. Can you please help confirm if that is ok? Thanks!

no please don't remove that one

@bhavin-a
Copy link
Contributor Author

bhavin-a commented Oct 8, 2021

Hi @Bhavin789 please update the threads also

@pal-sig Have updated the threads and resolved all except for the removal of cypress from root tsconfig. Can you please help confirm if that is ok? Thanks!

no please don't remove that one

@pal-sig Adding it back is actually throwing error on expect. Is this change breaking anything? As per my limited knowledge, cypress folder has its own tsconfig which is extending root one which should do the job even if we remove this.

Any idea on how can I check if anything is breaking?

If this is breaking anything, we can can by one redundant but easy route to explicitly include expect from jest which also looks fine to me. Ref

Let me know whichever way sounds good to you. Thanks!

@palashgdev
Copy link
Contributor

Ref

Hi @Bhavin789
I have checked and basic config and basic jest is working fine

I forget that cypress tsconfig.json is importing the root one. so removing ./cypress will fix our error

@palashgdev palashgdev assigned palashgdev and bhavin-a and unassigned palashgdev Oct 11, 2021
@bhavin-a
Copy link
Contributor Author

Ref

Hi @Bhavin789 I have checked and basic config and basic jest is working fine

I forget that cypress tsconfig.json is importing the root one. so removing ./cypress will fix our error

Awesome, thanks a ton for verification @pal-sig 🙌

Any reason why commit-lint is failing? Is there a way to re-trigger? Unable to understand the reason here.

@palashgdev
Copy link
Contributor

Ref

Hi @Bhavin789
I have checked and basic config and basic jest is working fine

I forget that cypress tsconfig.json is importing the root one. so removing ./cypress will fix our error

Ref

Hi @Bhavin789 I have checked and basic config and basic jest is working fine
I forget that cypress tsconfig.json is importing the root one. so removing ./cypress will fix our error

Awesome, thanks a ton for verification @pal-sig 🙌

Any reason why commit-lint is failing? Is there a way to re-trigger? Unable to understand the reason here.

You can check the logs

@palashgdev
Copy link
Contributor

Basically in the future will integrate husky with commit lint in the future which will reduce this type of error

@bhavin-a
Copy link
Contributor Author

Ref

Hi @Bhavin789 I have checked and basic config and basic jest is working fine

I forget that cypress tsconfig.json is importing the root one. so removing ./cypress will fix our error

Ref

Hi @Bhavin789 I have checked and basic config and basic jest is working fine
I forget that cypress tsconfig.json is importing the root one. so removing ./cypress will fix our error

Awesome, thanks a ton for verification @pal-sig 🙌
Any reason why commit-lint is failing? Is there a way to re-trigger? Unable to understand the reason here.

You can check the logs

I actually did but could not find any specific reason. The PR title contains the format defined by commitlint itself with a valid type and subject but still its failing. Can you help identify the issue? I might be missing something here.

image

@palashgdev
Copy link
Contributor

Ref

Hi @Bhavin789 I have checked and basic config and basic jest is working fine
I forget that cypress tsconfig.json is importing the root one. so removing ./cypress will fix our error

Ref

Hi @Bhavin789 I have checked and basic config and basic jest is working fine
I forget that cypress tsconfig.json is importing the root one. so removing ./cypress will fix our error

Awesome, thanks a ton for verification @pal-sig 🙌
Any reason why commit-lint is failing? Is there a way to re-trigger? Unable to understand the reason here.

You can check the logs

I actually did but could not find any specific reason. The PR title contains the format defined by commitlint itself with a valid type and subject but still its failing. Can you help identify the issue? I might be missing something here.

image

yeah it is checking on the previous commit too

@bhavin-a
Copy link
Contributor Author

yeah it is checking on the previous commit too

Oh, this shouldn't be the case, right? As per what I have seen, we squash commits, and thus, we don't need to lint on the commit history messages. Please correct me if I am wrong here.

In this case, is there any workaround to make the CI pass? @pal-sig
Thanks!

@ankitnayan ankitnayan merged commit 56fcc0c into SigNoz:main Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat(FE): Configure Jest
3 participants