Skip to content

Commit

Permalink
Switch to mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jan 11, 2015
1 parent fcaa6f3 commit cbd6c66
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 114 deletions.
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"version": "0.4.0",
"main": "fetch.js",
"devDependencies": {
"es6-promise": "1.0.0",
"qunit": "1.14.0"
"es6-promise": "1.0.0"
},
"ignore": [
".*",
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"private": true,
"devDependencies": {
"bower": "1.3.8",
"chai": "1.10.0",
"jshint": "2.5.2",
"node-qunit-phantomjs": "0.2.2"
"mocha-phantomjs": "3.5.2",
"mocha": "2.1.0",
"phantomjs": "1.9.13"
}
}
18 changes: 1 addition & 17 deletions test/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,11 @@
"browser": true,
"worker": true,
"globals": {
"MockXHR": false,
"QUnit": false,
"fetch": false,
"Headers": false,
"Request": false,
"Response": false,
"module": false,
"test": false,
"asyncTest": false,
"promiseTest": false,
"testDone": false,
"expect": false,
"start": false,
"stop": false,
"ok": false,
"equal": false,
"notEqual": false,
"deepEqual": false,
"notDeepEqual": false,
"strictEqual": false,
"notStrictEqual": false,
"raises": false
"assert": false
}
}
2 changes: 1 addition & 1 deletion test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ node ./test/server.js $port &>/dev/null &
server_pid=$!
trap "kill $server_pid" INT EXIT

node ./node_modules/.bin/node-qunit-phantomjs "http://localhost:$port/test/test.html"
node ./node_modules/.bin/mocha-phantomjs -s localToRemoteUrlAccessEnabled=true -s webSecurityEnabled=false "http://localhost:$port/test/test.html"
36 changes: 20 additions & 16 deletions test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,32 @@
<html>
<head>
<meta charset="utf-8">
<title>Test Suite</title>
<link rel="stylesheet" href="../bower_components/qunit/qunit/qunit.css">
<title>Fetch Tests</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div id="mocha"></div>
<script src="../node_modules/chai/chai.js"></script>
<script src="../node_modules/mocha/mocha.js"></script>
<script>
mocha.setup('tdd');
self.assert = chai.assert;
</script>

<script src="../bower_components/es6-promise/promise.js"></script>
<script src="../fetch.js"></script>
<script src="../bower_components/qunit/qunit/qunit.js"></script>

<script src="test.js"></script>

<script>
QUnit.promiseTest = function(testName, expected, callback) {
QUnit.test(testName, expected, function() {
stop();
Promise.resolve().then(callback).then(start, function(error) {
ok(false, error);
start();
});
});
mocha.checkLeaks();
//mocha.globals(['jQuery']);

if (self.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
}
window.promiseTest = QUnit.promiseTest;
</script>
<script>QUnit.config.testTimeout = 1000</script>
<script src="./test.js"></script>
</body>
</html>
Loading

0 comments on commit cbd6c66

Please sign in to comment.