gulp-qunit
gulp-qunit copied to clipboard
Error in plugin after a failed test
I have troubles running this plugin. I a test runner has all tests passed then everything is ok, but when some test fails, the plugin ends with error:
[00:09:37] Error in plugin 'gulp-qunit'
Message:
Command failed: PATH_TO_PROJECT\node_modules\gulp-qunit\node_modules\phantomjs\lib\phantom\phantomjs.exe PATH_TO_PROJECT\node_modules\gulp-qunit\node_modules\qunit-phantomjs-runner\runner-json.js file:///w:/projects/Twinstone/TDI/src/tests/test.html 10
Details:
killed: false
code: 1
signal: null
cmd: PATH_TO_PROJECT\node_modules\gulp-qunit\node_modules\phantomjs\lib\phantom\phantomjs.exe PATH_TO_PROJECT\node_modules\gulp-qunit\node_modules\qunit-phantomjs-runner\runner-json.js file:///w:/projects/Twinstone/TDI/src/tests/test.html 10
It crashes event with the simplest test:
<!DOCTYPE html>
<html>
<head>
<title>Test1</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.19.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="http://code.jquery.com/qunit/qunit-1.19.0.js"></script>
<script>
QUnit.test("Test1", function(assert) {
assert.ok(false, "lorem");
});
</script>
</body>
</html>
Gulpfile:
...
gulp.task('test', function () {
return gulp.src('test.html')
.pipe(qunit());
});
...
Any idea what is wrong, or what do I do wrong?
windows node: v4.1.2 gulp-qunit: 1.2.1
If I run the command manually in console, it looks like everything is running fine. This is the JSON it returns:
{
"result":{
"failed":1,
"passed":0,
"total":1,
"runtime":5
},
"exceptions":{
"Test1":[
"Failed assertion: lorem, expected: true, but was: false",
"at http://code.jquery.com/qunit/qunit-1.19.0.js:1307",
"at file:///PATH_TO_PROJECT/tests/test.html:14",
"at http://code.jquery.com/qunit/qunit-1.19.0.js:810",
"at http://code.jquery.com/qunit/qunit-1.19.0.js:942",
"at process (http://code.jquery.com/qunit/qunit-1.19.0.js:624)",
"at begin (http://code.jquery.com/qunit/qunit-1.19.0.js:606)",
"at http://code.jquery.com/qunit/qunit-1.19.0.js:666"
]
}
}
I am having the same issue. How did you run the plugin from the command line directly?
It errors because it is specifically told to if a test fails.
https://github.com/jonkemp/gulp-qunit/blob/master/index.js#L82
Isn't that desired behavior though?
I added a test with a failing test. I also added a task to the gulpfile that simply logs the errors without stopping the stream.
https://github.com/jonkemp/gulp-qunit/blob/master/gulpfile.js#L30