Giter Site home page Giter Site logo

Comments (13)

 avatar commented on August 17, 2024

The problem that jasmineDone never runs in the console_reporter, but I have no idea how to fix it. It runs every test, but after that it exits without reporting the failures. The suiteDone and specDone seems to run properly.

I guess the problem is in the core, so I have to dig deeper in the code. :S

from jasmine-npm.

 avatar commented on August 17, 2024

Here is what I got in webstorm:
nevtelen
and here is what I got in bash:
nevtelen2

from jasmine-npm.

 avatar commented on August 17, 2024

I created an issue by webstorm as well: https://youtrack.jetbrains.com/issue/WEB-15046

from jasmine-npm.

 avatar commented on August 17, 2024

I think I was wrong. I added console.log("x") to the first line, and it sometimes prints the x, sometimes not. If I add multiple console.log, only the first one prints, the seconds one not. There is no character limit, I removed a test file from about 5, and after that I did not get the x. After I restored the file, I got the x again, so it is rapsodic whether it prints. When I removed that test file, it did not end every test, or at least it did not write all F-s and .-s. So this is more serious than I previously thought.

from jasmine-npm.

 avatar commented on August 17, 2024

I think WebStorm forces the nodejs to close, or something like this happens. With a single test only it does not print anything. So it depends on the test count.

from jasmine-npm.

 avatar commented on August 17, 2024

WebStorm and PhpStorm has the same issue with reporters. It runs the code, but stops reporting after a while. I guess it depends on how many times you call the console.log or the stdout.write. I modified https://github.com/jasmine/jasmine-npm/blob/master/lib/command.js#L65 to write only a single time. Now it works in most of the cases, but sometimes prints nothing. (I guess this should be fixed by WebStorm, not here.)

function runJasmine(jasmine, env) {
  jasmine.loadConfigFile(process.env.JASMINE_CONFIG_PATH);

  var report = "";
  jasmine.configureDefaultReporter({
    showColors: env.color,
    print: function() {
        report += util.format.apply(this, arguments);
    },
    onComplete: function(passed) {
        process.stdout.write(report);
        if(passed) {
            process.exit(0);
        }
        else {
            process.exit(1);
        }
    }
  });
  jasmine.execute(env.files);
}

I think it is sad, that currently we cannot configure the default reporter in the config file. This whole code should be placed there as something exceptional.

from jasmine-npm.

slackersoft avatar slackersoft commented on August 17, 2024

Based on your investigation, this sounds like an issue with WebStorm terminating the jasmine command early and not jasmine-npm itself. Closing.

Thanks for using jasmine!

from jasmine-npm.

 avatar commented on August 17, 2024

You are right, I think it is a WebStorm issue. It does not terminate the command, but its console stops receiving the printed data. I had the same issue with PHPStorm and SimpleTest (an old PHP testing framework). I'll check the code of jasmine-node, maybe there is a known solution in there, because jasmine-node worked properly with these IDEs. I'll send a pull request if I find something. I'll add a feature request about the custom reporter.

from jasmine-npm.

 avatar commented on August 17, 2024

https://youtrack.jetbrains.com/issue/WEB-1926
It seems to be a 3 years old windows + nodejs issue which will be fixed in Node.js v0.11.12 I have the 0.10.36 now. That's all.

from jasmine-npm.

 avatar commented on August 17, 2024

I have found the perfect workaround. Just replace this line: https://github.com/jasmine/jasmine-npm/blob/master/lib/jasmine.js#L43

options.onComplete = options.onComplete || defaultOnComplete;

with this:

  options.onComplete = (function (onComplete) {
      return function (){
          var context = this;
          var args = arguments;
          setTimeout(function (){
                onComplete.apply(context, args);
          },1);
      };
  })(options.onComplete || defaultOnComplete);

If you have the same issue on windows. It simply defers the exit with 1ms. That seems to be enough time to end the printing. Good day, ciao!

from jasmine-npm.

segrey avatar segrey commented on August 17, 2024

Another workaround is to use https://github.com/cowboy/node-exit instead of process.exit as some other node console tools (e.g. grunt) do.

from jasmine-npm.

 avatar commented on August 17, 2024

Nice, it appears to be complicated to exit properly in node :D
https://github.com/cowboy/node-exit/blob/master/lib/exit.js

Thanks segrey!

from jasmine-npm.

amavisca avatar amavisca commented on August 17, 2024

@segrey Thanks for the workaround, I pulled in the exit module.

from jasmine-npm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.