Skip to content

Commit 7f614b3

Browse files
committed
Upgrade to mocha-phantomjs-core 1.1.0 to fix a few bugs
1 parent 74653d4 commit 7f614b3

5 files changed

+16
-10
lines changed

bin/mocha-phantomjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ program
6363
.usage('[options] page')
6464
.option('-R, --reporter <name>', 'specify the reporter to use', 'spec')
6565
.option('-f, --file <filename>', 'specify the file to dump reporter output')
66-
.option('-t, --timeout <timeout>', 'specify the test startup timeout to use', parseInt, 6000)
66+
.option('-t, --timeout <timeout>', 'specify the test startup timeout to use', parseInt)
6767
.option('-g, --grep <pattern>', 'only run tests matching <pattern>')
6868
.option('-i, --invert', 'invert --grep matches')
6969
.option('-b, --bail', 'exit on the first test failure')
@@ -106,7 +106,7 @@ var page = function(){
106106
}();
107107
var config = JSON.stringify({
108108
hooks: program.hooks,
109-
timeout: program.timeout,
109+
timeout: program.timeout || 6000,
110110
cookies: cookies,
111111
headers: headers,
112112
settings: settings,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
"dependencies": {
3939
"phantomjs": "1.9.7-15",
40-
"mocha-phantomjs-core": "< 2.0.0",
40+
"mocha-phantomjs-core": "^1.1.0",
4141
"commander": "^2.8.1"
4242
},
4343
"devDependencies": {

test/mocha-phantomjs.coffee

+3-4
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,15 @@ describe 'mocha-phantomjs', ->
4242
code.should.equal 1
4343
stderr.should.match /Unable to open file 'nonesuch'/
4444

45-
# https://github.com/nathanboktae/mocha-phantomjs-core/issues/5
46-
xit 'returns a failure code when mocha fails to run any tests', ->
45+
it 'returns a failure code when mocha fails to run any tests', ->
4746
{ code, stderr } = yield run [fileURL('no-tests')]
4847
code.should.equal 1
49-
stderr.should.match /Failed to run any tests/
48+
stderr.should.match /mocha.run\(\) was called with no tests/
5049

5150
it 'returns a failure code when mocha is not started in a timely manner', ->
5251
{ code, stderr } = yield run ['-t', 500, fileURL('timeout')]
52+
stderr.should.match /mocha.run\(\) was not called within 500ms of the page loading/
5353
code.should.not.equal 0
54-
stderr.should.match /Failed to run any tests/
5554

5655
it 'returns a failure code when there is a page error', ->
5756
{ code, stderr } = yield run [fileURL('error')]

test/resource-errors.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
<body>
1010
<div id="mocha"></div>
1111
<script src="../node_modules/mocha/mocha.js"></script>
12+
<script src="../node_modules/chai/chai.js"></script>
1213
<script>
13-
mocha.ui('bdd');
14-
mocha.reporter('html');
14+
mocha.ui('bdd')
15+
var expect = chai.expect
1516
</script>
17+
<script src="lib/passing.js"></script>
1618
<script>
17-
mocha.run();
19+
mocha.run()
1820
</script>
1921
</body>
2022
</html>

test/timeout.html

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
<meta charset="utf-8">
66
</head>
77
<body>
8+
<script src="../node_modules/chai/chai.js"></script>
9+
<script src="../node_modules/mocha/mocha.js"></script>
10+
<script> mocha.ui('bdd'); var expect = chai.expect</script>
11+
12+
<script src="lib/passing.js"></script>
813
</body>
914
</html>
1015

0 commit comments

Comments
 (0)