piotrwitek / ts-mocha

Mocha thin wrapper that allows running TypeScript tests with TypeScript runtime (ts-node) to get rid of compilation complexity
MIT License
189 stars 25 forks source link

The tsconfig.json is parsed as JSON instead of JSON5 #46

Open lazarljubenovic opened 4 years ago

lazarljubenovic commented 4 years ago

When you run tsc --init, you get a default setup for the tsconfig.json file, which is not actually a JSON file. It's a super-set of JSON which allows, amongst other things, trailing commas and comments in the JSON file. However, it seems like this module doesn't recognize this grammar, and thus fails to parse the default minimal setup with TypeScript:

SyntaxError: /home/.../tsconfig.json: Unexpected token / in JSON at position 29

After changing my tsconfig.json to be without comments (manually), the module works properly.

piotrwitek commented 4 years ago

Hey @lazarljubenovic It's using ts-node dependency to load tsconfig.json. There was a new major version for ts-node so I would check if it's supporting JSON5 and open a PR.