且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

运行node.js摩卡测试时出现意外令牌ILLEGAL

更新时间:2023-09-27 23:31:52

您的代码中有一些无效字符,如果您使用适当的文本编辑器,则会看到它们.行号有些偏离,但这显然是原因.

There are some invalid characters in your code, if you used proper text editor, you'd see them. The line numbering is a bit off, but this is clearly the cause.

以下是Sublime Text的屏幕截图:

Here's a screenshot from Sublime Text:

它是\uFFFC,更多信息此处.

只需删除它们(看不到它们,因此将所有内容从分号删除到下一个test().

Just delete them (they can't be seen, so delete all from the semicolon to the next test().