我正在尝试使用 Karma 和 Jasmine 在 phantomJS 中运行我的单元测试。单元测试和源文件都是用 Typescript 编写的。 测试在 Chrome、Safari 和 Firefox 中运行良好,但在 PhantomJS 中失败。错误:
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
Error: (SystemJS) eval@[native code]
tryCatchReject@/poc/node_modules/systemjs/dist/system-polyfills.src.js:1188:34
runContinuation1@/poc/node_modules/systemjs/dist/system-polyfills.src.js:1147:18
when@/poc/node_modules/systemjs/dist/system-polyfills.src.js:935:20
run@/poc/node_modules/systemjs/dist/system-polyfills.src.js:826:17
_drain@/poc/node_modules/systemjs/dist/system-polyfills.src.js:102:22
drain@/poc/node_modules/systemjs/dist/system-polyfills.src.js:67:15
Evaluating /poc/src/components/button/button.js
Error loading /poc/test/components/button/button.spec.ts
Run Code Online (Sandbox Code Playgroud)
我试图连接 phantomjs 调试器,但它没有抛出任何错误,所以我有点卡在这里。
业力配置:
module.exports = function (config) {
config.set({
customLaunchers: {
'PhantomJS_custom': {
base: 'PhantomJS',
options: {
windowName: 'my-window',
settings: {
webSecurityEnabled: false
}
},
flags: ['--load-images=true'],
debug: true
}
},
// base path that will be used to …Run Code Online (Sandbox Code Playgroud)