Skip to content

shmilyhuhuhu/mocha-browser-test

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

使用浏览器运行测试

使用浏览器打开index.html即可:

使用mocha-phantomjs运行测试

安装phantomjs和mocha-phantomjs(phantomjs模块更名为phantomjs-prebuilt):

sudo cnpm install -g phantomjs-prebuilt mocha-phantomjs

运行测试:

mocha-phantomjs --path /usr/local/bin/phantomjs ./test/index.html


  测试add函数
    ✓ 1加1等于2
    ✓ 1加2等于3


  2 passing (7ms)

使用npm test运行测试

因为package.json中配置npm的test脚本,因此可以直接使用npm test运行测试:

npm test

About

Mocha浏览器测试入门教程

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.8%
  • CSS 1.1%
  • HTML 0.1%