Tag: mocha phantomjs

幻影+摩卡+节点+打开网页

我正在尝试做一些非常简单的事情。 或者我想。 我想要做的就是使用phantomjs打开一个网页并声明其标题。 我正在使用mocha-phantomjs来调用我的testing运行器,如下所示: <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="../../node_modules/mocha/mocha.css" /> </head> <body> <div id="mocha"></div> <script src="../../node_modules/mocha/mocha.js"></script> <script src="../../node_modules/chai/chai.js"></script> <script> mocha.ui('bdd'); mocha.reporter('html'); </script> <script src="test.js"></script> <script> if (window.mochaPhantomJS) { mochaPhantomJS.run(); } else { mocha.run(); } </script> </body> </html> 和我的testing文件看起来 (function() { var page, url; page = require('webpage'); page = webpage.create(); url = "http://localhost:3000"; page.open(url, […]

在目录中运行所有'test.html'文件 – mocha-phantomjs

我有一个模块,我使用mocha-phantomjs来testing这个模块。 我创build了package.json文件 { "name" : "demo-test", "scripts": { "test": "npm run test-debug", "test-debug": "mocha-phantomjs ./test/Test1.html" }, "dependencies" : { "mocha" : "1.13.x", "commander" : "1.2.x", "which" : "~1.0.5", "mocha-phantomjs": "3.3.2" }, "devDependencies" : { "chai" : "1.8.x", "coffee-script" : "1.6.x", "requirejs" : "2.1.x", "jquery" : "2.1.0" } } 然后我运行npm install ,然后npm test来运行testing。 它工作正常,并运行test1.html的testing。 现在我想要在testing目录下的所有文件(test1,test2,…)在执行npm test执行。 […]

运行testing时npm错误ELIFECYCLE

我正在使用mocha-phantomjs设置进行unit testing。 我有以下package.json脚本运行testing。 "scripts": { "test": "npm run testFlickr", "testFlickr": "mocha-phantomjs ./test/FlickrTest.html" } 这在浏览器中运行正常。 当我运行cmd命令npm test时,testing运行正常,但它也给出了以下错误 3 passing (5s) 6 failing npm ERR! flickr-test@ testFlickr: `mocha-phantomjs ./test/FlickrTest.html` npm ERR! Exit status 6 npm ERR! npm ERR! Failed at the flickr-test@ testFlickr script. npm ERR! This is most likely a problem with the flickr-test package, npm […]