Typescript + Jest runs locally but not in Circle

I have a little issue running Jest + TS in Circle. Locally all of the test works, but when running on Circle – after fetching all the code from Github – raises this error:

 FAIL  test/utils.test.ts
  ● Test suite failed to run

    SyntaxError: Unexpected token {
      at _load_jsdom (node_modules/jest/node_modules/jest-cli/node_modules/jest-environment-jsdom/build/index.js:18:19)

I think this might be related with Jest not running Jest-ts in Circle – maybe some Docker configuration might fix it? --; the problem is that I don’t know how to fix it. Can anybody help me with that or at least give me some ideas how I can debbug this?

I don’t know this technology, but some general advice: there is not much that is special about Circle run environments, same as most CI providers. It’s a VPS. So, the question is, if you got this error on your development laptop, how would you fix it?

Have you looked at the file containing a syntax error?

One thing you can do is to kick off a build with SSH, let it fail, and then log into the post-fail machine. Then you can use a text editor to play around with things until you get your tests to pass. Just remember that SSH time eats into your build minutes, so don’t wander off to watch a movie :smile: and remember to cancel the job from the Circle web interface.

I’ve never used SSH before, but maybe it’s time to look into it.


Right, learning SSH generally is essential. I don’t want to put you off using Circle, or CI generally, but sometimes it throws up seriously non-trivial problems. The SSH feature on Circle really is great - some other providers don’t offer this, and it can be really hard to work out what’s going on.

If you don’t already have a VPS, get one - you can get one for a few USD per month these days. Learn SSH and the console generally and Linux commands - you’ll find using CI much easier with that knowledge.

The funny thing though is that I decided to try it out Travis CI and worked just fine. Probably I’ll stay with them right now.

Sure, fair enough. A couple of years ago, I used Travis for some open source stuff, but for unfunded closed source projects, their prices are quite prohibitive.

I haven’t used Travis recently, and to be fair, I like Circle so much now, I would probably use it for new open source projects. It’d be interesting to go back to Travis to see what their feature-set looks like now.

I’m having the same problem - tests execute fine on local, but don’t even run due to the above syntax error. Haven’t tried Travis yet, though I have used it in the past too.

This is my working project with Travis and TS, in case that you need some help:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.