Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error silenced when test not found/import inside test not found. #212

Open
chenglou opened this Issue · 16 comments

5 participants

@chenglou
jasmine-node spec/nonexistentFile.spec.js

This doesn't throw an error. Neither does this:

var nonexsitent = require("../noexistentFile")

then

jasmine-node spec/theAboveTest.spec.js

I don't remember jasmine doing this. Maybe it's because I upgraded to Node 0.10.1?

@tebriel

In v0.8.21 I get:

cmoultrie@Sauron~/G/jasmine-node (master) $ jasmine-node spec/SampleSpecs.jsa

fs.js:524
  return binding.stat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '/Users/cmoultrie/Git/jasmine-node/spec/SampleSpecs.jsa'
    at Object.fs.statSync (fs.js:524:18)
    at Object.jasmine.loadHelpersInFolder (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/index.js:42:20)
    at Object.<anonymous> (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/cli.js:184:11)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/jasmine-node/bin/jasmine-node:7:1)

and

cmoultrie@Sauron~/G/jasmine-node (master) $ node
> require("doesntexist")
Error: Cannot find module 'doesntexist'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at repl:1:2
    at REPLServer.self.eval (repl.js:109:21)
    at Interface.<anonymous> (repl.js:248:12)
    at Interface.EventEmitter.emit (events.js:96:17)
    at Interface._onLine (readline.js:200:10)
    at Interface._line (readline.js:518:8)
> 

So yes, looks like that's a 0.10.1 issue. But maybe I should add a test to see if the file exists? It doesn't seem like a bad plan....

@pako1337

Any workaround for this issue? I'm completely new to the whole CoffeeScript and Jasmine-node fun stuff so I hate wasting time figuring out what's wrong (when nothing seems wrong in the first place) with my tests so they don't run at all.

@tebriel
@chenglou

For me, CoffeeScript has nothing to do with it, since it failed silently between my CoffeeScript updates (still, I'm using 1.6.2).

@pako1337

node version: v0.10.3
coffee version: 1.6.2
So latest versions I think, since I've installed them few days ago.

@tebriel

Okay. Can you open up the node repl and type: require('fakename') and see if the repl exceptions? I'm not near a box I can try that on. If it does exception in your version of node then something is wrong, otherwise it's a "feature" of the new node versions.

@chenglou

On node 0.10.1 for me, it still throws a module not found exception.

@tebriel

Okay, I'll promote this to a real issue and try to figure out what is going on. It may be that as the vm gets built up it supresses that stuff in its sandbox.

Now a part of 1.5.1 milestone. I will hopefully figure out something this weekend.

@tebriel

@chenglou @pako1337 Can you guys test the beta1.5.1 branch? This fixes it in all my tests, but I'd like a second set of eyes.

@pako1337

Seems to be working. Using normal jasmine-node non-existing file error gets suppressed. Using beta version it gives following output:

d:\Programming\CoffeeScript\Jasmine-Node beta test\jasmine-node>node lib\jasmine-node\cli.js --coffee s
Exception loading: d:\Programming\CoffeeScript\Jasmine-Node beta test\jasmine-node\s/s.spec.coffee
{ [Error: Cannot find module '../nop'] code: 'MODULE_NOT_FOUND' }

Finished in 0 seconds
0 tests, 0 assertions, 0 failures

So it looks ok for me.
I hope that's what you expected - took me some time to get my head around some issues while trying to run this beta version :)

I should probably raise another issue for other (e.g. compilation) messages being suppressed?

@tebriel

As in, exceptions while passing the file to coffee-script for compilation?

And yes, that was the output I was expecting.

@chenglou

Yeah it works. Running a missing file throws the error now.
And yes, exceptions while compiling. Right now it silently "errors" with 0 tests, 0 assertions, 0 failures.

@tebriel

Okay, I'll look into that, hopefully it'll be pretty much the same.

@tebriel

The previously mentioned fix is now on NPM as 1.6.0. I have not fixed the Coffeescript compilation issue, but that'll be in 1.6.1.

@conorgil

Having a similar issue. I am getting a 'MODULE_NOT_FOUND' output, but I expect that to completely fail the test run and show an error in red. Instead, it shows everything running fine, marks passing tests in green and hides the fact that a module could not be loaded.

$> jasmine-node --matchall tests/
Exception loading: /tests/small/rpc/acm-message-test.js
{ [Error: Cannot find module '../../../lib/rpc/request-info'] code: 'MODULE_NOT_FOUND' }
...........

Finished in 0.009 seconds
11 tests, 13 assertions, 0 failures

Is it possible to tell jasmine-node to fail if there is an exception? I tried adding --captureExceptions thinking I would get this functionality, but no dice.

Thoughts?

node version v0.10.5
jasmine-node version 1.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.