Skip to content

Commit cbd6c66

Browse files
committed
Switch to mocha
1 parent fcaa6f3 commit cbd6c66

File tree

6 files changed

+103
-114
lines changed

6 files changed

+103
-114
lines changed

bower.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"version": "0.4.0",
44
"main": "fetch.js",
55
"devDependencies": {
6-
"es6-promise": "1.0.0",
7-
"qunit": "1.14.0"
6+
"es6-promise": "1.0.0"
87
},
98
"ignore": [
109
".*",

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"private": true,
66
"devDependencies": {
77
"bower": "1.3.8",
8+
"chai": "1.10.0",
89
"jshint": "2.5.2",
9-
"node-qunit-phantomjs": "0.2.2"
10+
"mocha-phantomjs": "3.5.2",
11+
"mocha": "2.1.0",
12+
"phantomjs": "1.9.13"
1013
}
1114
}

test/.jshintrc

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,11 @@
1818
"browser": true,
1919
"worker": true,
2020
"globals": {
21-
"MockXHR": false,
22-
"QUnit": false,
2321
"fetch": false,
2422
"Headers": false,
2523
"Request": false,
2624
"Response": false,
27-
"module": false,
2825
"test": false,
29-
"asyncTest": false,
30-
"promiseTest": false,
31-
"testDone": false,
32-
"expect": false,
33-
"start": false,
34-
"stop": false,
35-
"ok": false,
36-
"equal": false,
37-
"notEqual": false,
38-
"deepEqual": false,
39-
"notDeepEqual": false,
40-
"strictEqual": false,
41-
"notStrictEqual": false,
42-
"raises": false
26+
"assert": false
4327
}
4428
}

test/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ node ./test/server.js $port &>/dev/null &
1111
server_pid=$!
1212
trap "kill $server_pid" INT EXIT
1313

14-
node ./node_modules/.bin/node-qunit-phantomjs "http://localhost:$port/test/test.html"
14+
node ./node_modules/.bin/mocha-phantomjs -s localToRemoteUrlAccessEnabled=true -s webSecurityEnabled=false "http://localhost:$port/test/test.html"

test/test.html

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,32 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<title>Test Suite</title>
6-
<link rel="stylesheet" href="../bower_components/qunit/qunit/qunit.css">
5+
<title>Fetch Tests</title>
6+
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
77
</head>
88
<body>
9-
<div id="qunit"></div>
10-
<div id="qunit-fixture"></div>
9+
<div id="mocha"></div>
10+
<script src="../node_modules/chai/chai.js"></script>
11+
<script src="../node_modules/mocha/mocha.js"></script>
12+
<script>
13+
mocha.setup('tdd');
14+
self.assert = chai.assert;
15+
</script>
16+
1117
<script src="../bower_components/es6-promise/promise.js"></script>
1218
<script src="../fetch.js"></script>
13-
<script src="../bower_components/qunit/qunit/qunit.js"></script>
19+
20+
<script src="test.js"></script>
21+
1422
<script>
15-
QUnit.promiseTest = function(testName, expected, callback) {
16-
QUnit.test(testName, expected, function() {
17-
stop();
18-
Promise.resolve().then(callback).then(start, function(error) {
19-
ok(false, error);
20-
start();
21-
});
22-
});
23+
mocha.checkLeaks();
24+
//mocha.globals(['jQuery']);
25+
26+
if (self.mochaPhantomJS) {
27+
mochaPhantomJS.run();
28+
} else {
29+
mocha.run();
2330
}
24-
window.promiseTest = QUnit.promiseTest;
2531
</script>
26-
<script>QUnit.config.testTimeout = 1000</script>
27-
<script src="./test.js"></script>
2832
</body>
2933
</html>

0 commit comments

Comments
 (0)