寻找有关如何查明无效/意外令牌的实际来源的建议。
我正在用 cypress 运行测试,并且大部分时间(虽然不一致),我从我的所有测试中都会收到这个错误。
Uncaught SyntaxError: Invalid or unexpected token
This error originated from your application code, not from Cypress.
When Cypress detects uncaught errors originating from your application it will automatically fail the current test.
This behavior is configurable, and you can choose to turn this off by listening to the 'uncaught:exception' event.
https://on.cypress.io/uncaught-exception-from-application
Run Code Online (Sandbox Code Playgroud)
所以让我们说清楚;我明白这是我的应用程序代码的问题,而不是我的测试代码。我的问题是我还没有看到任何指向语法错误实际位置的信息。此外,我在 chrome 72(不是通过 cypress)中运行该应用程序并且我没有问题。当我通过 cypress 运行应用程序时似乎只有一个问题(也使用 chrome 72,因为我在运行 cypress 规范时使用)。--browser chrome
我已经在我的测试中添加了fail, …