monounity / karma-typescript

Simplifying running unit tests with coverage for Typescript projects.
314 stars 109 forks source link

SyntaxError: Invalid number (19:15) #113

Closed soupman99 closed 7 years ago

soupman99 commented 7 years ago

I setup my files according to this post: https://github.com/monounity/karma-typescript/issues/110#issuecomment-292936366

Then I get this error when I run karma start Any idea of what to do?


11 04 2017 13:37:53.603:INFO [compiler.karma-typescript]: Compiling project using Typescript 2.2.2
11 04 2017 13:37:57.582:INFO [compiler.karma-typescript]: Compiled 26 files in 3628 ms.
11 04 2017 13:37:58.795:ERROR [karma]: { SyntaxError: Invalid number (19:15)
at Parser.pp$4.raise (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:2488:13)
at Parser.pp$7.readNumber (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:3153:50)
at Parser.pp$7.getTokenFromCode (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:2976:17)
at Parser.pp$7.readToken (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:2733:15)
at Parser.pp$7.nextToken (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:2724:13)
at Parser.pp$7.next (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:2684:8)
at Parser.pp$3.parseMaybeAssign (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:1760:10)
at Parser.pp$3.parseExpression (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:1722:19)
at Parser.pp$1.parseStatement (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:777:45)
at Parser.pp$1.parseBlock (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:1040:23)
at Parser.pp$1.parseStatement (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:754:31)
at Parser.pp$1.parseIfStatement (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:879:26)
at Parser.pp$1.parseStatement (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:743:28)
at Parser.pp$1.parseBlock (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:1040:23)
at Parser.pp$3.parseFunctionBody (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:2362:22)
at Parser.pp$1.parseFunction (/electron-starter/node_modules/karma-typescript/node_modules/acorn/dist/acorn.js:1132:8)
pos: 426,
    loc: Position { line: 19, column: 15 },
    raisedAt: 430 }
erikbarke commented 7 years ago

Hey @soupman99, most likely the acorn parser barfs on octal literals like 08 or 09 in the source of an npm package required by your code, I've added some error logging for this to help you find the culprit.

To try it out, install from the development branch: npm i github:monounity/karma-typescript#next

soupman99 commented 7 years ago

@erikbarke thanks!!! I'll give it shot and let you know how it goes.

erikbarke commented 7 years ago

v3.0.1 with better error logging is on npm now!