Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

Problems using Jasmine Node #125

Open
baldore opened this issue Aug 25, 2016 · 0 comments
Open

Problems using Jasmine Node #125

baldore opened this issue Aug 25, 2016 · 0 comments

Comments

@baldore
Copy link

baldore commented Aug 25, 2016

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant