Which command I use to run test.js files (selenium/jest)

I create the files TaskInput,js and TaskInput.test.js and TaskList.js and TaskList.test.js, but not sure what command to use for run the files.
I tried to use npm run + the name of the file ‘TaskList.test.js’ but it arrows some error logs, then I tried to use: npx jest TaskList.test.js, bit it shows different errors

Hi @Tatiana_Tejada !!
Here’s a step-by-step guide on how to run tests using jest for your javascript files:

  1. First, make sure you have Jest installed in your project. If not, you can install it locally by running:
npm install --save-dev jest
  1. Ensure that your package.json file has a script set up for running Jest tests. You can add or modify a script like this:
"scripts": {
  "test": "jest"
  1. Write your test files (TaskInput.test.js and TaskList.test.js) and your source files (TaskInput.js and TaskList.js).

  2. In your test files, make sure you’re importing the functions or classes you want to test from the corresponding source files.

  3. Now, you can run Jest from the command line. If you want to run all tests in all files, you can simply run:

npm test

If you want to run tests for a specific file, you can specify the file path relative to the root of your project:

npx jest TaskList.test.js

Make sure you’re running these commands from the root directory of your project where your package.json file is located.

If you’re encountering errors, make sure you’ve followed these steps correctly and that your test files and source files are set up properly. If you’re still having trouble, feel free to provide more details about the errors you’re encountering, and I can try to help you troubleshoot further.
Happy Learning :blush: