Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hangs with slimerjs > 0.9.6 #25

Open
yairEO opened this issue Jun 8, 2016 · 10 comments
Open

hangs with slimerjs > 0.9.6 #25

yairEO opened this issue Jun 8, 2016 · 10 comments

Comments

@yairEO
Copy link

yairEO commented Jun 8, 2016

Using with slimerjs, I manage to run my tests successfully from CMD:

slimerjs mocha-phantomjs-core.js tests.html tap

Slimerjs window opens, I see the a browser window and all seems good, but the CMD doesn't finish. nothing is happening until I close the slimerjs window. I want to output the test result (using TAP reporter) as a file (for jenkins to consume)

is it even possible?

@nathanboktae
Copy link
Owner

You can either pipe to a file with the shell slimerjs .... > output.tap or use the --file option.

But are your tests hanging or mocha-phantomjs-core?

@yairEO
Copy link
Author

yairEO commented Jun 8, 2016

I've created a tests2.html file:

<html>
    <head>
        <meta charset="utf-8">
        <link href="mocha.css" rel="stylesheet" />
    </head>
    <body>
        <div id="mocha"></div>
        <script src="../node_modules/mocha/mocha.js"></script>
        <script src="../node_modules/chai/chai.js"></script>
        <script>
            mocha.setup('bdd');
            mocha.ui('bdd');
            var expect = chai.expect;
            var should = chai.should();
            var assert = chai.assert;
        </script>
        <script>
            describe('foo', function(){
                it('bar', function(){
                    'a'.should.eql('a');
                })
            });

            mocha.run();
        </script>
    </body>
</html>

The slimerjs window is open and keeps open, even when the test has passed using

slimerjs mocha-phantomjs-core.js tests2.html > o.tap

o.tap file was created empty

t

@yairEO
Copy link
Author

yairEO commented Jun 8, 2016

I also now see that system.stderr.writeLine doesn't work on CMD or GIT bash... I've changed mocha-phantomjs-core.js fail function stderr to do stdout instead. now I get the error:

Likely due to external resource loading and timing, your tests require calling window.initMochaPhantomJS() before calling any mocha setup functions. See #12

finally, it was the need to add window.initMochaPhantomJS(); before the setup function.. how silly! all this because I couldn't see any error due to the stderr issue not printed :/

@yairEO yairEO changed the title output reporter result to file output reporter result to file (hang without errors) Jun 8, 2016
@nathanboktae
Copy link
Owner

I also now see that system.stderr.writeLine doesn't work on CMD or GIT bash...

Because slimerjs doesn't support it.

What version of slimerjs are you using? I had the tests break and haven't been able to look into it yet so there may have been some contract breakage or regression there.

btw outputing to a file has nothing to do with it. I'm sure if you tried phantomjs2 your tests would run just fine, and you can output the file via those two ways.

@yairEO
Copy link
Author

yairEO commented Jun 8, 2016

did npm install slimerjs just now so I'm using the latest. Their package.json: "version": "0.906.1"

Regarding your last paragraph, I had nothing but hell using phantomjs for running tests (i'm writing tests and get tons of errors from phantom for them not passing because of variables not defined, like window.cancelAnimationFrame and so on, so I had enough of that and decided to change to slimejs and now everything works great!

(my tests are complex and include testing DOM output so I need a good up-to-date headless browser and i'm not sure phantomjs is as updated as slimerjs in terms of DOM API and latest JS engine)

@nathanboktae nathanboktae changed the title output reporter result to file (hang without errors) hangs with slimerjs 0.906.1 Jun 8, 2016
@nathanboktae
Copy link
Owner

0.9.6 or 0.906.1 ? that's an odd build number....

@yairEO
Copy link
Author

yairEO commented Jun 8, 2016

I did npm install then went to \node_modules\slimerjs\package.json scrolled down to version and copy pasted it. it's that number. I also thought it was odd, since it says on the website the latest is 0.10 so I thought maybe they forgot to update the package.json file

@nathanboktae
Copy link
Owner

Yeah I was using 0.9.6 when I released 4.0 that supported it - see https://travis-ci.org/nathanboktae/mocha-phantomjs-core/jobs/110061074. You may want to install that version to unblock you for now. I'm curious to see if that works for you.

@yairEO
Copy link
Author

yairEO commented Jun 8, 2016

Changed to 0.9.6 and indeed everything is good, no hanging, and finally things are printed on the terminal. who would have guessed... Thanks :)

@yairEO yairEO closed this as completed Jun 9, 2016
@nathanboktae nathanboktae changed the title hangs with slimerjs 0.906.1 hangs with slimerjs > 0.9.6 Jun 9, 2016
@nathanboktae
Copy link
Owner

Oh this is a big issue - need to fix it, definately not closed :) Thanks for your report and investigation.

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

No branches or pull requests

2 participants