4
在Ember应用程序中运行我的测试时出现此错误。显然,语法错误(Unexpected token ','
)以某种方式发生,导致测试环境的非常负载失败,因此它使每个测试都失败。由于PhantomJS语法错误,Ember.js测试失败
$ 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: |
...
注意上面的第一个错误,即认为global failure
然后报告意外逗号令牌。之后,所有剩余的测试失败,或者是因为他们无法导入存在的文件,或者因为没有设置testResolver
或其他东西。
事情就是一切在浏览器中正常运行。看起来这与PhantomJS在某些地方对某些语法更加严格有关。但是在错误消息中没有说明这个流氓逗号的位置。
有人可以给我一些关于如何找到这个逗号或解决这个错误的提示吗?提前致谢。
您可能会认为我可以看看引入错误的提交的差异。那么,它会导致合并提交。合并前两个合并分支中的任何一个都不会发生错误。它只发生在其中一个分支合并到另一个之后。合并过程中根本没有任何冲突,因此可能会引入语法错误。即使是这样,错误也不会在开发模式下的浏览器中体现出来,就在运行测试时。 – Ernesto
运行一些ES5语法检查器来查找错误。 –
恐怕我使用了太多的ES6功能,所以ES5语法检查程序会跟我的代码搞得一团糟。或不?我错过了什么吗? – Ernesto