Tabcorp / atom-mocha-test-runner

Mocha test runner for Atom Editor
https://atom.io/packages/mocha-test-runner
MIT License
38 stars 18 forks source link

"Mocha test results..." and a black window #60

Open erelsgl opened 8 years ago

erelsgl commented 8 years ago

I created a trivial test in my test folder:

describe('trivial test', function() {
    it('does nothing', function() {
      console.log("hello mocha")
  })
})

When I click Ctrl+Alt+M, I see a pink title "Mocha test results...". Below it, there is a black empty window. This remains like this indefinitely.

Mocha runs fine when I run it from the root of my project.

Here are the relevant lines from my packages.json file:

,
  "devDependencies": {
    "mocha": ">=1.0.0",
    "should": ">=0.6.0"
  },
  "scripts": {
    "test": "mocha"
  },
rprieto commented 8 years ago

Thanks for raising this. Can you add a screenshot of what it looks like?

erelsgl commented 8 years ago

I try to upload the screenshot to github but it does not work. I can send you by email if you want.

gustavnikolaj commented 8 years ago

I had a similar problem. The plugin couldn't find my node executable, and the result was a black screen. My problem was that I didn't have a system level node and only use nvm (I opened a feature request here #61 )

You can test if this is the problem by going to your terminal and run: which node and add the outputted path as the path to your node executable in the settings for this plugin.

stmllr commented 8 years ago

having the same issue, using:

Running test from https://github.com/stmllr/node-test-package with the following result (context information activated):

atom-mocha-test-runner

andyrichardson commented 7 years ago

I can agree with @gustavnikolaj - I experienced the same issue due to the node location being incorrect. It would be nice if the package called node without using it's explicit path (as it's likely already declared in the systems PATH variable).

Just for clarity, I'm using Fedora 25 (Linux) and the default node directory is /usr/bin/node.

rprieto commented 7 years ago

Thanks @andyrichardson. I'll run some more tests, but I think Atom plugins don't have access to the calling environment, including the user's $PATH. Do you have any other suggestions on how to fix it?

As a starting point, I'll add an explicit error message if Node can't be found.

andyrichardson commented 7 years ago

@rprieto off the top of my head, I know atom-script calls environment variables using bash in Linux and Mac.

/bin/bash -c mocha $args

Something like that might work and you can be sure that bash is in the bin folder and make use of environment variables.