Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

345
Views
Why I have a typescript error when I run my TU?

I my working on a angular 8 project and have some trouble with TU execution.

When I run my TU with ng test I get this error:

> ng test --progress --browsers ChromeHeadless_custom

10% building 1/1 modules 0 active05 01 2022 16:01:11.191:INFO [karma-server]: Karma v4.4.1 server started at http://0.0.0.0:9876/
05 01 2022 16:01:11.195:INFO [launcher]: Launching browsers ChromeHeadless_custom with concurrency unlimited
05 01 2022 16:01:11.201:INFO [launcher]: Starting browser ChromeHeadless

ERROR in TypeError: Cannot read property 'lastIndexOf' of undefined
    at Object.startsWith (C:\Users\e12404\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:1914:20)
    at isPathRelativeToParent (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:93723:23)
    at C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:93682:24
    at Object.firstDefined (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:295:26)
    at getPathRelativeToRootDirs (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:93680:23)
    at tryGetModuleNameFromRootDirs (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:93553:40)
    at getLocalModuleSpecifier (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:93422:44)
    at C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:93409:96
    at Array.map (<anonymous>)
    at Object.getModuleSpecifiers (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:93409:57)
    at getSpecifierForModuleSymbol (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:35318:62)
    at createExpressionFromSymbolChain (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:35434:49)
    at symbolToExpression (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:35429:24)
    at C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:34427:106
    at withContext (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:34456:37)
    at symbolToExpression (C:\Users\v\Documents\project\lib_common\node_modules\typescript\lib\typescript.js:34427:28)

npm ERR! Test failed.  See above for more details.

See console output

The project builds with no error. So maybe it's a problem in my tests.

I saw similar problems but it was about vscode typescript parser or about a typescript bug.

I have the same error with typescript@3.5.3 and typescript@4.5.0

Do you have any ideas ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!