accerqueira / sublime-test-runner

Sublime Text plugin for running tests.
MIT License
22 stars 0 forks source link

Not running my tests on save #3

Closed simonexmachina closed 10 years ago

simonexmachina commented 10 years ago

I think it's not running my tests on save, at least I can't see any evidence that it is.

I've configured my Makefile so that make test REPORTER=tap (in the project root directory) runs mocha, but when I save in Sublime nothing happens, except [ executed ] appears in the status bar.

I'm running Sublime Text 3 stable channel build 3059.

Thanks!

accerqueira commented 10 years ago

Which version of node are you using? I had problems with some older versions that would truncate piped output.

Just tested on Windows, with Sublime Text 3 build 3059, GNU Make 3.81 and node.js v0.10.24, using the following Makefile and it worked...

REPORTER ?= dot

test:
    @node ./node_modules/mocha/bin/_mocha -R $(REPORTER)

.PHONY: test

And had mocha installed locally on the project. You could also install it globally and run it with "mocha -R $(REPORTER)" instead.

Can you run "make test REPORTER=tap" directly from the shell and post the output? You can also try running "node ./node_modules/mocha/bin/_mocha -R tap" or "mocha -R tap" and checking if the output is ok.

simonexmachina commented 10 years ago

I'm using version 0.10.22 on a Mac.

Running make test REPORTER=tap definitely works in the terminal.

Here's the Makefile:

REPORTER ?= dot

test:
    @node ./node_modules/mocha/bin/_mocha --compilers coffee:coffee-script -R $(REPORTER)

.PHONY: test

And here's the output:

$ make test REPORTER=tap
1..1
ok 1 proxy server should accept connections
# tests 1
# pass 1
# fail 0
accerqueira commented 10 years ago

Hmmm Do you have one of the following folders next to the Makefile? test tests spec specs

Currently, Test Runner does not look for a Makefile, it looks for one of these folders. The reason is that you could change the testing command to something else that doesn't use make, a .bat on Windows for instance, but I probably shouldn't rely on one of those folders being present either...

The solution I can think of, is looking for a .test-runner file on the parent folders, if not found, fallback to running on the same folder as the sublime-project file, if not in a project, fallback to running on same folder as the current file. Will try to implement and release this possible solution today.

accerqueira commented 10 years ago

Ended up doing another way, an easier one. hehe Now you can setup the files it should look for, and it also looks for Makefile by default. Could you upgrade and tell me if it works?

simonexmachina commented 10 years ago

Yes, I have a test/ folder.

Have upgraded and still nothing happens when I save, although make test does work.

maximeaubaret commented 10 years ago

I have the same problem here. I've not been able to run my mocha tests.

accerqueira commented 10 years ago

Just tested on a Linux with node.js v0.10.22 and v0.10.25, both worked... I'll add some debug logging and ask for your help on debugging this...

accerqueira commented 10 years ago

Released version v1.4.0. Although I was just going to add logging, I found and fixed some glitches that didn't affect me but were bad for ST3. This version may fix this issue, but if it doesn't, could you do the following? Navigate to "Preferences > Package Settings > Test Runner > Settings - User" Paste the following lines: { "log_level": "debug" } Save and try triggering Test Runner for your project again.

maximeaubaret commented 10 years ago

Thanks for the quick response. I've upgraded Test Runner to the release 1.4.0, and set the "log_level" to "debug" value in "Preferences > Package Settings > Test Runner > Settings - User". I'm using Sublime 3 Build 3059 and Node v0.10.25.

The upgrade has not fixed the problem, and no logs are showing in the window.

But I know for a fact that my Makefile is used, and that the 'test' rule is executed: by adding a 'say hi' command inside of the 'test' rule and setting the volume on my Mac, I can hear the sound the computer talk.

Here is my Makefile:

REPORTER=tap

test:
    say 'hi'
    @./node_modules/mocha/bin/_mocha -R $(REPORTER)

.PHONY: test

And here are my User Settings:

{
  "show_panel_default": true,
  "log_level": "debug"
}
simonexmachina commented 10 years ago

Yep I can confirm exactly the same for me.

accerqueira commented 10 years ago

I forgot to tell that the log should be on Sublime Text console and also on a file, probably "Test Runner.TestRunner.log" inside ST3 folder.

On Sat, Jan 25, 2014 at 11:28 PM, Simon Wade notifications@github.comwrote:

Yep I can confirm exactly the same for me.

— Reply to this email directly or view it on GitHubhttps://github.com/accerqueira/sublime-test-runner/issues/3#issuecomment-33306239 .

accerqueira commented 10 years ago

Hmm, just discovered that if you don't have permission to write on that folder, the log wont be output at all... will change that... I'll try to get an OSX for testing stuff...

simonexmachina commented 10 years ago

The log file was being written on my machine and showed me that Sublime's process doesn't have a correct path. So I've added PATH=/usr/local/bin at the top of my Makefile and it's now running node.

maximeaubaret commented 10 years ago

I'm going to try this... Let me get back to you.

maximeaubaret commented 10 years ago

Thanks! It finally works :) Adding the path in my Makefile did the trick.

accerqueira commented 10 years ago

Awesome! Closing this, but feel free to post if you encounter more issues.