-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting_setup_comment.html
17 lines (14 loc) · 1.2 KB
/
testing_setup_comment.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!--
*****babel & jest configuration setup*****
For testing we use the jest framwork and babel is used to support .mjs files. Babel helps to converts modules to common js.
1. install babel & jest packages; install command: "npm i -D @babel/core @babel/node @babel/preset-env jest".
2. create a .babelrc file in main project folder,'express', and configure the file as shown in that .babelrc file.
3. using terminal install the jest using command: npm init jest@latest
for correct answers of the prompts during install see the screenshot in mian folder.
4. configure the automatically created "jest.config.mjs" after completing step 3.
Here, the ' moduleFileExtensions[...]' array is modified by removing unnecessary extentions.
Then, for transform map we set: {"^.+\\m?js$" : "babel-jest",}. It is obtained from JEST Code Transformation web page.
5. Create jsconfig.json and configure the file as shown in that jsconfig.json file. Also , install another npm package : npm i -D @types/jest.
6. Finally,check the package.json file where the test value inside scripts will be "jest"
____##### , Now we are set to go for testing , #####_________
-->