Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit f665dbd

Browse files
committed
Fixed files order
1 parent c3b887d commit f665dbd

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var argv = parseArgs(process.argv.slice(2));
44

55
var blendQunit = function(files) {
66
if(argv.failOnError){
7-
files.unshift({
7+
files.push({
88
pattern: __dirname + '/karma-qunit-cli-fail.js',
99
included: true,
1010
served: true,

lib/karma-qunit-cli-fail.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
QUnit.testDone(function(details) {
1+
var __qunit_cli_fail__ = function(details) {
22
if(details.failed){
33
throw new Error(details.name);
44
}
5-
});
5+
};
6+
7+
if(QUnit && typeof QUnit.testDone === 'function'){
8+
QUnit.testDone(__qunit_cli_fail__);
9+
}else if(testDone === 'function'){
10+
testDone(__qunit_cli_fail__);
11+
}

test/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ var assert = require('assert');
44

55
var defaultFiles = ['test.js'];
66

7-
it('it should not prepend the file if flag --failOnError', function (cb) {
7+
it('it should add the file if flag --failOnError', function (cb) {
88
process.argv.push('--failOnError');
99
var frameworkFactory = require('../lib/index')['framework:qunit-cli-fail'][1];
1010
frameworkFactory(defaultFiles);
1111

1212
assert.equal(defaultFiles.length, 2, 'files length must be 2');
13+
assert.equal(defaultFiles[0], 'test.js', 'files should not be sorted');
14+
assert(defaultFiles[1].pattern.match(/karma-qunit-cli-fail.js/), 'last file must be karma-qunit-cli-fail.js');
1315

1416
cb();
1517
});

0 commit comments

Comments
 (0)