gpt4 book ai didi

由于 PhantomJS 语法错误,Ember.js 测试失败

转载 作者:行者123 更新时间:2023-12-02 03:57:34 24 4
gpt4 key购买 nike

我在 Ember 应用程序中运行测试时收到此错误。显然,存在语法错误(意外的标记“,”),该错误的发生方式导致测试环境的加载失败,因此导致每个测试都失败。

$ ember test
version: 1.13.13
Built project successfully. Stored in "/Users/ernesto/code/projects/my-app/frontend/tmp/class-tests_dist-cqvfx9XF.tmp".
not ok 1 PhantomJS 2.0 - global failure
---
actual: >
null
message: >
SyntaxError: Unexpected token ','
Log: |
...
not ok 2 PhantomJS 2.0 - global failure
---
actual: >
null
message: >
Error: Could not find module `frontend/config/environment` imported from `frontend/tests/helpers/resolver`
Log: |
...
not ok 3 PhantomJS 2.0 - global failure
---
actual: >
null
message: >
Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js".
Log: |
...
not ok 4 PhantomJS 2.0 - Integration | Component | dropdown filter: it renders all given options and the empty option
---
actual: >
null
message: >
Promise rejected before it renders all given options and the empty option: you must set a resolver with `testResolver.set(resolver)`
Log: |
...

请注意上面的第一个错误,它显示全局失败,然后报告意外的逗号标记。之后,所有剩余的测试都会失败,要么是因为它们无法导入存在的文件,要么是因为 testResolver 未设置,或者其他原因。

问题是浏览器中的一切都运行正常。看来这与 PhantomJS 对某些地方的某些语法更加严格有关。但错误消息中没有指示该恶意逗号所在的位置。

有人可以给我一些关于如何找到这个逗号或以某种方式解决这个错误的提示吗?提前致谢。

最佳答案

当对象具有重复的属性名称时,PhantomJS 会抛出语法错误,例如:

var object = { foo: 1, foo: 2 };

大多数浏览器不会将此视为语法错误,而只是使用最后一个属性定义。

关于由于 PhantomJS 语法错误,Ember.js 测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36208755/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com