Phantomjs中的karma单元测试不起作用,但是firefox可以正常工作

时间:2017-08-01 21:31:04

标签: javascript angularjs unit-testing phantomjs karma-jasmine

我对angularjs进行了单元测试。在今天之前,我使用Firefox通过打开localhost:9876来运行我的单元测试,这总是有效。

现在,我想在Phantomjs中运行单元测试,但失败了。我花了一天时间调试这个,但我还没弄明白。

结果如下:

[exec] DEBUG [config]: Loading config /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/karma.conf.js
 [exec] DEBUG [config]: autoWatch set to false, because of singleRun
 [exec] DEBUG [plugin]: Loading plugin karma-jasmine.
 [exec] DEBUG [plugin]: Loading plugin karma-phantomjs-launcher.
 [exec] DEBUG [plugin]: Loading plugin karma-coverage.
 [exec] INFO [karma]: Karma v0.10.8 server started at http://localhost:9876/
 [exec] INFO [launcher]: Starting browser PhantomJS
 [exec] DEBUG [launcher]: Creating temp dir at /tmp/karma-72048017
 [exec] DEBUG [launcher]: /brazil-pkg-cache/packages/NodeJS-phantomjs/NodeJS-phantomjs-1.9.207.589/RHEL5_64/DEV.STD.PTHREAD/build/lib/commonjs/phantomjs/lib/phantom/bin/phantomjs /tmp/karma-72048017/capture.js
 [exec] DEBUG [watcher]: Excluded file "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/karma.conf.js"
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/app/app.js".
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/clock/clock.js".
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/cms/cms.js".
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/oncall/oncall.js".
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/metrics/metrics.js".
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/pipelines/pipelines.js".
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/progressbar/progressbar.js".
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/serviceInvoker/serviceInvoker.js".
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/services/DDADashboard.services.js".
 [exec] DEBUG [preprocessor.coverage]: Processing "/local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/tickets/tickets.js".
 [exec] DEBUG [watcher]: Resolved files:
 [exec]     /brazil-pkg-cache/packages/NodeJS-karma-jasmine/NodeJS-karma-jasmine-0.0.x.0.2230/RHEL5_64/DEV.STD.PTHREAD/build/lib/commonjs/karma-jasmine/lib/jasmine.js
 [exec]     /brazil-pkg-cache/packages/NodeJS-karma-jasmine/NodeJS-karma-jasmine-0.0.x.0.2230/RHEL5_64/DEV.STD.PTHREAD/build/lib/commonjs/karma-jasmine/lib/adapter.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/app/app.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/clock/clock.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/cms/cms.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/metrics/metrics.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/oncall/oncall.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/pipelines/pipelines.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/progressbar/progressbar.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/serviceInvoker/serviceInvoker.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/services/DDADashboard.services.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/webapp/components/tickets/tickets.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/app/appTest.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/cms/cmsTest.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/helper/helperTest.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/metrics/metricsTest.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/oncall/oncallTest.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/pipelines/pipelinesTest.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/progressbar/progressbarTest.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/serviceInvoker/serviceInvokerTest.js
 [exec]     /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/tickets/ticketsTest.js
 [exec] DEBUG [web-server]: serving: /brazil-pkg-cache/packages/NodeJS-Karma/NodeJS-Karma-0.10.117.541/RHEL5_64/DEV.STD.PTHREAD/build/lib/commonjs/karma/static/client.html
 [exec] DEBUG [web-server]: serving: /brazil-pkg-cache/packages/NodeJS-Karma/NodeJS-Karma-0.10.117.541/RHEL5_64/DEV.STD.PTHREAD/build/lib/commonjs/karma/static/karma.js
 [exec] DEBUG [karma]: A browser has connected on socket 6ben0vWrCpB2gZJcrqB4
 [exec] INFO [PhantomJS 1.9.1 (Linux)]: Connected on socket 6ben0vWrCpB2gZJcrqB4
 [exec] DEBUG [karma]: All browsers are ready, executing
 [exec] DEBUG [web-server]: serving: /brazil-pkg-cache/packages/NodeJS-Karma/NodeJS-Karma-0.10.117.541/RHEL5_64/DEV.STD.PTHREAD/build/lib/commonjs/karma/static/context.html
 [exec] DEBUG [web-server]: serving: /brazil-pkg-cache/packages/NodeJS-karma-jasmine/NodeJS-karma-jasmine-0.0.x.0.2230/RHEL5_64/DEV.STD.PTHREAD/build/lib/commonjs/karma-jasmine/lib/jasmine.js
 [exec] DEBUG [web-server]: serving: /brazil-pkg-cache/packages/NodeJS-karma-jasmine/NodeJS-karma-jasmine-0.0.x.0.2230/RHEL5_64/DEV.STD.PTHREAD/build/lib/commonjs/karma-jasmine/lib/adapter.js
 [exec] DEBUG [web-server]: serving: /tmp/2ee2a73c83d55d061f219fdde3d8da097dad299c.js
 [exec] DEBUG [web-server]: serving: /tmp/4cb495ec4104f2973975474c12c021ec2aca4400.js
 [exec] DEBUG [web-server]: serving: /tmp/daf16889dba2a79f1595ea1c61bd6d31907e6100.js
 [exec] DEBUG [web-server]: serving: /tmp/6c9ff62070e0619a2d89e10b0d9bb2ca7a6a159e.js
 [exec] DEBUG [web-server]: serving: /tmp/a69812b29fd05a0211fed4472d3aba13e2c003fc.js
 [exec] DEBUG [web-server]: serving: /tmp/9cbc96fcf70cbb4d172d13a7bda55b0220f868aa.js
 [exec] DEBUG [web-server]: serving: /tmp/f191085464bac965afa8b2510f9ff03ac7d91c28.js
 [exec] DEBUG [web-server]: serving: /local/home/heyannan/workplace/DDADashboardUI/src/DDADashboardUI/tst/components/app/appTest.js
 [exec] DEBUG [web-server]: serving: /tmp/1cd6a4b97d8dd99167ff0cc73d1fd9ea0c932d8e.js
 [exec] DEBUG [web-server]: serving: /tmp/be119531b4f8043216711bbea310c53790288399.js
 [exec] DEBUG [web-server]: serving: /tmp/6d15e1033c35f7efe381d511969b4f3e8e2f920e.js
 [exec] PhantomJS 1.9.1 (Linux) ERROR
 [exec]     Script error.
        PhantomJS 1.9.1 (Linux): Executed 0 of 0 ERROR (0.21 secs / 0 secs)
 [exec] DEBUG [launcher]: Disconnecting all browsers
 [exec] DEBUG [launcher]: Killing PhantomJS
 [exec] 
 [exec] =============================== Coverage summary ===============================
 [exec] Statements   : 100% ( 0/0 )
 [exec] Branches     : 100% ( 0/0 )
 [exec] Functions    : 100% ( 0/0 )
 [exec] Lines        : 100% ( 0/0 )
 [exec] ================================================================================
 [exec] DEBUG [launcher]: Process PhantomJS exitted with code 0
 [exec] DEBUG [launcher]: Cleaning temp dir /tmp/karma-72048017

希望有人可以给我一些点击。非常感谢!

0 个答案:

没有答案