Jasmine duplicates test cases to subsequent files

Open
#2,294 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript, node.js
Domain
testing-qa

Research direction

Start at Nodejs/Product/TestAdapter/TestFrameworks/Jasmine/jasmine.js around lines 115-126, where the Jasmine instance is created and files are processed. Reproduce with a .NET Standard project containing two or more test files, then verify that each test case appears only under its own file after rebuilding the project.

Written by the indexing model from the issue text.

Description

Expected Behavior

Test cases are just listed under the file they exist in

Actual Behavior

Test cases are also listed under all subsequent files

I think the issue might be some form of caching in here.
https://github.com/microsoft/nodejstools/blob/587d04559aaef7288c51ef8420fff67c38257006/Nodejs/Product/TestAdapter/TestFrameworks/Jasmine/jasmine.js#L115-L126
If I move the creation of the jasmine instance (Lines 115+116) inside the forEach, i.e. a new one for each file, the test cases only appear for the correct file.

  • NTVS Version: 1.5.20902.1 Commit Hash:b474efcb6f92db52a8f8e2e6a8cb9648476885cc
  • Visual Studio Version: 16.8.0 Preview 3.2
  • Node.js Version: 10.15.0
  • Jasmine: 3.6.1
Steps to Reproduce
  1. Create a .netstandard project following https://docs.microsoft.com/en-us/visualstudio/javascript/unit-testing-javascript-with-visual-studio?view=vs-2019#unit-test-net-core-and-net-standard
  2. Add 2 or more test files
  3. Rebuild project
Dominant language
C#
Stars
1.8k
Forks
355
PR merge metrics
No merged PRs in 30d

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.

More from microsoft/nodejstools

All issues in microsoft/nodejstools

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.