busterjs / buster

Abandoned - A powerful suite of automated test tools for JavaScript.
http://docs.busterjs.org
Other
448 stars 37 forks source link

buster-html-doc doesn't enjoy Windows linebreaks #390

Closed cjohansen closed 10 years ago

cjohansen commented 10 years ago

Typing in an HTML doc (/*:DOC something = <div> ...*/) with newlines on Windows causes "uncaught exception: undefined" from Buster. I have previously added a test to buster-html-doc that adds an \r and it didn't catch any errors, so I would like some help reproducing this on a Windows box. @dwittner ?

dwittner commented 10 years ago

@cjohansen, i will investigate it on windows right now.

dwittner commented 10 years ago

This test leads to the following JavaScript-Code in the browser:

var assert = buster.assert;

buster.testCase("some tests", {

    "test": function () {
        this.element = (function () {var element = document.createElement("div");element.innerHTML = "<div class=\"yeah\">
\n       </div>";if (element.childNodes.length > 1) {throw new Error("HTML doc expected to only contain one root node, found " + element.childNodes.length); }return element.firstChild; }());/*:DOC element = <div class="yeah">
         </div>*/
        assert.equals(this.element.className, "yeah");    }
});
dwittner commented 10 years ago

But the issue only exists for the version 1.0.0 of buster-html-doc. It is already fixed on master by commit f7e4d7fbd2.

cjohansen commented 10 years ago

I had tagged it and everything, seems I just forgot to push to npm... Fixed now. Thanks!