douglasduteil / isparta

:skull: A code coverage tool for ES6 (babel/6to5)
Do What The F*ck You Want To Public License
642 stars 47 forks source link

Problems using Jasmine Node #125

Open baldore opened 8 years ago

baldore commented 8 years ago

Hi there! I'm having some troubles with my configuration. Right now I have a file like this:

'use strict';

// require('babel-core/register'); // Commented since I think this is the problem.

const jasmine = new (require('jasmine'))();

const document = (require('jsdom').jsdom)('', { url: 'http://localhost:3000' });
let window = document.defaultView;

Object.keys(window).map(key => {
  const propertyDescriptor = Object.getOwnPropertyDescriptor(global, key);

  if (propertyDescriptor === undefined) {
    global[key] = window[key];
  }
});

global.document = document;
global.navigator = window.navigator;
global.window = document.defaultView;
global.XMLHttpRequest = window.XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;

global.getJasmineRequireObj = () => jasmine;

require('jasmine-ajax');

// Environment setup
global.ENV = 'TEST';

// Removes React warnings during tests
process.env.NODE_ENV = 'production';

  /*
   * Jasmine Initialization
   */
  jasmine.loadConfig({
    spec_dir: 'test',
    spec_files: [
      '**/*.spec.js'
    ]
  });

  jasmine.onComplete(function(passed) {
    process.exit(passed ? 0 : 1);
  });

  jasmine.execute();

The issue is that, it doesn't take any spec file in the coverage. It just show this file and I don't know what the problem is. I tried with Istanbul, Isparta, using babel-node and anything works. I think the problem is babel, since I need to apply it somewhere in order to run all the tests.