Skip to content

Conversation

@i786m
Copy link

@i786m i786m commented Oct 26, 2025

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I have implemented the various functions and the associated tests for the functions.

Questions

The instructions for sprint 1 say that the npm install should be run within the sprint 1 folder but when I attempt to use the Testing tab on vscode I am unable to run the tests from within and the output indicates the tests fail to run as it seems to be looking in the root folder for the node module for jest. I was able to run the tests using npm test however the testing functionality afforded by vscode was diminished by that. Could there be a better way of doing this?

@i786m i786m added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 26, 2025
@i786m
Copy link
Author

i786m commented Oct 26, 2025

image I enclose a screenshot to demonstrate the error returned pertinent to the question I asked when initially opening this PR

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 8, 2025
@i786m i786m added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 10, 2025
@i786m i786m requested a review from cjyuan November 10, 2025 19:10
@cjyuan
Copy link
Contributor

cjyuan commented Nov 10, 2025

Have you installed Jest first? To install Jest, in a terminal, run npm install in the Sprint-1 folder. npm will look for package.json and then install all dependencies specified in package.json.

Only after that you can run Jest test.

@cjyuan
Copy link
Contributor

cjyuan commented Nov 10, 2025

Changes look good.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 10, 2025
@i786m
Copy link
Author

i786m commented Nov 10, 2025

Have you installed Jest first? To install Jest, in a terminal, run npm install in the Sprint-1 folder. npm will look for package.json and then install all dependencies specified in package.json.

Only after that you can run Jest test.

I ran npm install in the sprint 1 folder as per instructions and have no issue using npm test via terminal, my question relates to running the tests via the testing tab in vscode and the respective functionality in the test files to run an individual test
image

It's not a hinderance, just wondering why its behaving this way and if there's a work around as I would like to be able to leverage the in file single test run functionality as opposed to having to run npm test each time

@cjyuan
Copy link
Contributor

cjyuan commented Nov 10, 2025

I don't know how to use the Jest extension in VSCode.
In terminal, we could run jest test on a particular file (in Sprint-1 folder where jest is installed locally) as

 npm test <substring that match the filename>

For examples,

  • npm test fix will run all the .test.js files inside subfolder fix (because all other filenames do not have such substring).
  • npm test median will run fix/median.test.js (since that's the only file with the matching substring)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants