-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat-#6: Setup jest rtl #84
feat-#6: Setup jest rtl #84
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
d28c0a2
to
c0d1d88
Compare
Just some observations:
I assume it is bymistake, because we are aiming to just setup the jest in this PR, correct me if I am wrong. About the folderstructure and filenames we might have to discuss about the tradeoffs, Can you confirm if these filenames are by default designed to be that way? or is it custom file names? if custom we have to follow our guidelines. |
Another benefit of starting the folder name with a non-letter or number is that it won't get mixed up with folders containing "production" code when you list the directories.
|
@shmbajaj, Thank you for the quick update, just one more thing, i see we have lots of settings and many things in the json files, can we minimize it to what we actually want presently than getting everything at once, if everything is actually needed, we can have a call where you roughly say whats the importance of each of things.
I understand, I am open to this, and I have seen at places being used this way, we'll discuss and come to decision, which will be best for our project and we can change in the backend aswell if needed. |
Kindly follow commit format, refer #67 for better understanding, hope you don't get pestered, I understand for the new contributors it will not suddenly pop in mind because we are so involved in the code, but this was done so that we know in just a split of second what the commit is about as in a long run we know what to actually catch or look out for, hope you get it :) p.s: I have also planned to keep some regex constraints before commiting, @chinmaykunkikar doesn't really agree the necessity of it though :| Let's see what we can do, I guess I'll have to convince him anyways xD |
Hmm.. I don't think we can do anything about it. That's just the part (and the pain) of using the current js ecosystem. May be a
Most of them are the part of setup process to ensure things are running smoothly. If
That's not completely true :P I agree with your intent, it just that it may discourage someone who thinks they're being constrained by git. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shmbajaj this looks good to me to start with. We can always modify it according to our needs later.
Note
@krishnaacharyaa please check if anything on vercel needs to be changed for this to work. See if the production
and the test
environments is being recognized by vercel. We don't want the test specific logic to run on prod.
Yeah this one, I'll have to see, @shmbajaj can we do just this in another PR? or is it actually required right away? meaning we can sit together and properly differentiate whatever is needed for dev and prod environments including backend. If it is the main part of this. we'll sit and figure out. If that's fine by you @chinmaykunkikar (vercel is calling you) xD. Let's see what would be the required changes and the best practices, we'll separate it accordingly. |
@krishnaacharyaa @chinmaykunkikar Let's connect over call and conclude this PR, and |
It is required, and we need to resolve the PR fast. |
I can't really provide any suggestions on this PR, since I'm not equipped with enough knowledge of jest. |
Hey @kuldeepjambhulkar, No issues you can watch this quick video on how to setup jest or even good read a 5 minute tutorial on topic in discussion. YT Video: Mastering Jest Configuration for React TypeScript Projects with Vite: A Step-by-Step Guide Blog: Mastering Jest Configuration for React TypeScript Projects with Vite: A Step-by-Step Guide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, LGTM
Sorry for the delay in merging...
Test cases are always a little tough one xD
Summary
This pull request addresses Issue #6 by adding integration tests to the frontend using Jest for a React TypeScript project created with Vite. The goal is to enhance the application's stability and security as it grows in size.
Description
This pull request introduces Jest as the testing framework for the React TypeScript project. The setup includes configuring Jest to work seamlessly with Vite, handling TypeScript, JSX syntax, and integrating testing libraries for React.
Steps Taken:
Install Dependencies:
Exclude Test Files from TypeScript Type Checking for Production:
tsconfig.prod.json
to exclude test files.package.json
to usetsconfig.prod.json
during production build.Add Test Script to
package.json
:Write Simple Test:
src/App.test.tsx
to check if 1 + 1 equals 2.Test the
App
Component:App
component.Configure JSX Support with Babel:
@babel/preset-env
,@babel/preset-react
, and@babel/preset-typescript
..babelrc
file to configure Babel presets.Install Testing Libraries for React:
Configure Jest Environment:
ts-node
andjest-environment-jsdom
.jest.config.ts
to configure Jest settings.Fix
import.meta
Error:ts-jest-mock-import-meta
.import.meta
of Vite.Images
NA
Issue(s) Addressed
#6
Prerequisites
Additional Information
Reviewers are encouraged to inspect the changes and provide feedback.