Reputation: 2808
I'm using jest to unit test my server and when I set the "testRegex" on my package.json to be
"testRegex": "(/test/.*|(\.|/)test)\.js$"
I get this error: Unexpected token . in JSON
Any ideas?
Upvotes: 0
Views: 489
Reputation: 1850
"\."
is invalid escape character in JSON. You need to escape the backslash:
"testRegex": "(/test/.*|(\\.|/)test)\\.js$"
Upvotes: 2