microsoft / microsoft/nodejstools

Issues when testing with jest

Open
#2,140 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.8k
Forks
355
PR merge metrics
No merged PRs in 30d

Description

Issues

@armanio123 as discussed at https://github.com/MicrosoftDocs/visualstudio-docs/issues/1989 you can find example code at.
https://github.com/Saulzi/nodejsissues.git

you will need to restore packages etc, standard stuff.
all tests run in jest by running test with npx jest

Issue 1.
Not all tests are discovered, (because of how node-editor-support) detects tests, likewise detected tests are not correctly displayed in test hierarchy.

Issue 2.
when package.json and node_modules are in folder pointed to in JavascriptTestRoot, no tests are discovered.

[07/03/2019 10:31:20 Error] Failed to find "jest" package. "jest" must be installed in the project locally.
[07/03/2019 10:31:20 Error] Install "jest" locally using the npm manager via solution explorer
[07/03/2019 10:31:20 Error] or with ".npm install jest --save-dev" via the Node.js interactive window.

Issue 3 - think this one is already documented at (https://docs.microsoft.com/en-us/visualstudio/javascript/unit-testing-javascript-with-visual-studio?view=vs-2017), .net core projects dont work at all.

Issue 4 - typescript built using outdir does not get detected.
[07/03/2019 10:52:08 Informational] Processing: C:\Users\t.salisbury\Desktop\TestingIssues\Issues\Issue 4\source\cool.test.js
[07/03/2019 10:52:12 Error] Test discovery error: { Error: ENOENT: no such file or directory, open 'C:\Users\t.salisbury\Desktop\TestingIssues\Issues\Issue 4\source\cool.test.js'
[07/03/2019 10:52:12 Error] at Object.openSync (fs.js:439:3)

Issue 5 - does not like noemit / jest using babel

Issue 6 - does not ignore tests in node_modules

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Saulzi/nodejsissues example: restore its packages and run the tests with npx jest. Inspect package.json, node_modules, JavascriptTestRoot, and the reported source/cool.test.js path while reproducing the six discovery and configuration problems. Done means the reported Jest and TypeScript test-discovery cases have clear, verified behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, typescript
Domain
developer-experience, testing-qa, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.