Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why jasmine-node doesn't find my spec files?

I have installed jasmine-node using npm. My project's directory structure are following:

|-lib\
   |-taxCalc.js
|-spec\
   |-taxCalc.spec.coffee
   |-taxCalc.spec.js
|-src\
   |-taxCalc.coffee

When I run jasmine-node from root folder with following command (for CoffeeScript):

jasmine-node --coffee --verbose spec

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

Same if I run JavaScript version.

If I explicitly point to spec file tests run fine:

jasmine-node --coffee --verbose spec/taxCalc.spec.coffee

Tax calculation
  calculates tax

Finished in 0.009 seconds
1 test, 1 assertion, 0 failures

Documentation says that file names should end with 'spec.js' or 'spec.coffee', so everything seems ok.

P.S. I am running on Windows 7.

like image 574
marisks Avatar asked Jan 30 '12 10:01

marisks


People also ask

Can Jasmine be integrated with node js?

We can install Jasmine for node. js by running npm install jasmine-node -g . We provide the -g option to install it globally, so we're able to run jasmine-node from the command line.

How do I install Jasmine framework?

Setting up JasmineGive your code access to Jasmine, downloading it manually or with a package manager. Initialize Jasmine. Create a spec (test) file. Make the source code available to your spec file.

What is Jasmine Nodejs?

NODE AND BROWSER Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a DOM. And it has a clean, obvious syntax so that you can easily write tests. Get Started.


2 Answers

Jasmine-node has been updated in the last week to use walkdir instead of findit which now makes it function in windows. Re-run npm install jasmine-node for the update.

like image 138
Matt Smith Avatar answered Sep 28 '22 18:09

Matt Smith


Stumbled upon the same problem and have read MarisKs link too late :/ - but came to the same conclusion as described in the issue: At least on Windows 7, file.stat.ino returns always 0, so the function createInodeChecker() in findit/index.js returns always true and the file will be skipped.

Easiest on-the-fly-fix: edit createInodeChecker to

function createInodeChecker() {
    var inodes = {};
    return function inodeSeen(inode) {
        if (inode == 0) {
            return false;
        }

        if (inodes[inode]) {
            return true;
        } else {
            inodes[inode] = true;
            return false;
        }
    }
}

Not nice, but you can work with it.

like image 43
schakko Avatar answered Sep 28 '22 20:09

schakko