Skip to content

Commit

Permalink
Merge pull request alsotang#71 from huguangju/master
Browse files Browse the repository at this point in the history
fixed mocha-phantomjs 'SSL handshake failed'
  • Loading branch information
alsotang committed Nov 16, 2015
2 parents de72bb1 + ac4fe02 commit a5ed512
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
14 changes: 8 additions & 6 deletions lesson7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,20 @@ npm i -g mocha-phantomjs

```html
<script>
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
if (window.initMochaPhantomJS && window.location.search.indexOf('skip') === -1) {
initMochaPhantomJS()
}
mocha.ui('bdd');
expect = chai.expect;
mocha.run();
</script>
```

这时候, 我们在命令行中运行

```shell
mocha-phantomjs index.html
mocha-phantomjs index.html --ssl-protocol=any --ignore-ssl-errors=true
```

结果展现是不是和后端代码测试很类似 :smile:
Expand All @@ -123,7 +125,7 @@ mocha-phantomjs index.html

```json
"scripts": {
"test": "mocha-phantomjs index.html"
"test": "mocha-phantomjs index.html --ssl-protocol=any --ignore-ssl-errors=true"
},
```

Expand Down
12 changes: 7 additions & 5 deletions lesson7/vendor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</head>
<body>
<div id="mocha"></div>
<script src='https://raw.githubusercontent.com/chaijs/chai/master/chai.js'></script>
<script src='https://cdn.rawgit.com/chaijs/chai/master/chai.js'></script>
<script>
var fibonacci = function (n) {
if (n === 0) {
Expand All @@ -24,11 +24,13 @@
<script>mocha.setup('bdd')</script>
<script src="tests.js"></script>
<script>
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
if (window.initMochaPhantomJS) {
initMochaPhantomJS();
mocha.ui('bdd');
expect = chai.expect;
}

mocha.run();
</script>
</body>
</html>

0 comments on commit a5ed512

Please sign in to comment.