Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocha tests discovered but do not seem to run #683

Closed
frauss opened this issue Feb 11, 2016 · 10 comments
Closed

Mocha tests discovered but do not seem to run #683

frauss opened this issue Feb 11, 2016 · 10 comments

Comments

@frauss
Copy link

frauss commented Feb 11, 2016

I'm trying to move a Node.js project I created using WebStorm to Visual Studio and am having problems running Mocha unit tests.

When I try to 'Run all...' from the test explorer it seems build and run something but not my tests.

Here's the output I get:

------ Run test started ------
Processing: C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel contentFilter save single should create new content filter with the name 'Unit Test Filter'::Mocha
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel contentFilter save multiple should find 5 content filters whose names start with 'Unit Test Filter'::Mocha
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel contentFilter populate test create a test transform and test filter referring to it and populate it::Mocha
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel endpoint save single should create new endpoint with the name 'Unit Test Endpoint'::Mocha
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel endpoint save multiple should find 5 endpoints whose names start with 'Unit Test Endpoint'::Mocha
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel contentRule save single should create new rule with the name 'Unit Test Rule::Mocha
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel contentRule save multiple should find 5 rules whose names match the regex /Unit Test Rule Number \d+/'::Mocha
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel contentRule populate test create a test rule and referenced filter and endpoints and populate it::Mocha
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel transformation save single should create new transform with the name 'Unit Test Transformation::Mocha
  Creating TestCase:C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel transformation save multiple should find 5 rules whose names match the regex /Unit Test Transformation Number \d+/'::Mocha
Processing finished for framework of Mocha
========== Run test finished: 10 run (0:00:23.7025712) ==========

However, I receive none of the console output I would expect from my tests.

I imagine something is misconfigured but just not sure what.

Thanks,
Fred

@mousetraps
Copy link
Contributor

Is the test framework property set to mocha in file properties?
image

@frauss
Copy link
Author

frauss commented Feb 12, 2016

Yes.

[image: Inline image 1]

I see the tests in the test explorer:

[image: Inline image 2]

However when I try to run or debug them they don't seem to run and I'm not
seeing anything in the output indicating where the problem is.

Fred

On Thu, Feb 11, 2016 at 7:23 PM, Sara Itani notifications@github.com
wrote:

Is the test framework property set to mocha in file properties?
[image: image]
https://cloud.githubusercontent.com/assets/762848/12995383/c68cd3e0-d0db-11e5-99e7-a45b574913f5.png


Reply to this email directly or view it on GitHub
#683 (comment)
.

@mousetraps
Copy link
Contributor

Thanks. What happens if you set a breakpoint on the first line of one of the tests, and right click > debug in test explorer? Does it run or hit the breakpoint? What if you add a console.log to the test? Does it show up in the Output after running the tests? (see screenshot below) Do you have a simple example that reproduces the issue?
image

@frauss
Copy link
Author

frauss commented Feb 14, 2016

No, it never hits the breakpoint. Here's the the results:

Test Name: keystoneModel contentFilter save single should create new
content filter with the name 'Unit Test Filter'
Test FullName: C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js::keystoneModel
contentFilter save single should create new content filter with the name
'Unit Test Filter'::Mocha
Test Source: C:\Sources\eAP\DigitalPlatforms\Syndication\Keystone\Node.js\KeystoneDMIngest\test\keystoneModel.Test.js
: line 0
Test Outcome: Failed
Test Duration: 0:00:01.8910134

Here's the Debug Output window:

The thread 'main thread' (0x1) has exited with code 0 (0x0).

The program '[1] node.exe @ tcp://localhost:65325/#ping=0' has exited with
code -1 (0xffffffff).

I never see a console window that indicates Node is running. Is there a way
to get more detailed output or another window I could check?

Fred

------ Run test started ------

========== Run test finished: 1 run (0:00:06.4980418) ==========

Here's the Debug Output window:

The thread 'main thread' (0x1) has exited with code 0 (0x0).

The program '[1] node.exe @ tcp://localhost:59895/#ping=0' has exited with
code -1 (0xffffffff).

On Sun, Feb 14, 2016 at 1:05 AM, Sara Itani notifications@github.com
wrote:

Thanks. What happens if you set a breakpoint on the first line of one of
the tests, and right click > debug in test explorer? Does it run or hit the
breakpoint? What if you add a console.log to the test? Does it show up in
the Output after running the tests? (see screenshot below) Do you have a
simple example that reproduces the issue?
[image: image]
https://cloud.githubusercontent.com/assets/762848/13032177/b9877e3e-d29d-11e5-9ed0-5cbc60320f6a.png


Reply to this email directly or view it on GitHub
#683 (comment)
.

@mousetraps
Copy link
Contributor

Does the same issue occur with the included mocha item templates?

Can you please walk me through the exact steps you're taking, including code snippets? It would be especially helpful to start with a basic console app and see if you can get things working there first.

@vickymittal
Copy link

@mousetraps
I encountered the same issue:

Steps:

  1. Created a new Project, Node.js -> Blank Node.js Console Application.
  2. In solution folder executed, npm install mocha
  3. Under Solution, Add Item -> New Item -> JavaScript Mocha UnitTest file.
  4. For UnitTest.js, changed Test Framework to Mocha
  5. In Test Explorer, right clicked 'Test Suite 1 Test 1' -> Run Selected Tests, Test Passed.
  6. Set Breakpoint as below:
    image
  7. In Test Explorer, right clicked 'Test Suite 1 Test 1' -> Debug Selected Tests, Test Failed.
  8. Clicked on Output, got following screen:
    image
  9. Output of Node.js Tools Live Diagnostics:
    Node.js Tools Live Diagnostics.txt

On a fresh machine and new installation, followed the same above steps, except:
6. In Test Explorer, right clicked 'Test Suite 1 Test 1' -> Debug Selected Tests.
7. The project entered into debug mode, stopping at the breakpoint.
8. On Clicking Continue, test passed with following output:
image

@vickymittal
Copy link

@mousetraps The issue seems to be with Node.js 4.3.0, upgraded to 4.4, and it works now.

@frauss
Copy link
Author

frauss commented Mar 16, 2016

Upgrading to 4.4 definitely fixed the issue. I had previously been running
4.2.6.

Not sure what the issue was but vickymittal thanks for the info!!

Fred

On Wed, Mar 16, 2016 at 12:00 PM, vickymittal notifications@github.com
wrote:

@mousetraps https://github.com/mousetraps The issue seems to be with
Node.js 4.3.0, upgraded to 4.4, and it works now.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#683 (comment)

@vickymittal
Copy link

@frauss, this was due to bug in nodejs (nodejs/node#4440)

@mjbvz
Copy link
Contributor

mjbvz commented Jun 22, 2016

Seems like this has a known resolution. Closing this issue.

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

No branches or pull requests

4 participants