Right, so I have jest running tests for my back end. I just set up circleci and finally got to where it will run my tests. It passes the tests that I had written (with jest) however, it is failing at typescript in the built in Angular Karma tests.
Hi Christian. I often see this when Node doesn’t like to see TypeScript. What version of node are you running, and are you using ts-jest or compiling first?
Hi @drazisil thanks for the fast reply! $ node -v v10.15.3
as for ts-jest I am not sure. As I was following along with Coding Train’s tutorial and was integrating his tutorial with my Angular project.
I tried your way since after reading over ts-jest it looks like it is made for typescript so just incase… or is ts-jest just made for if using typescript in the backend?
ts-jest allows jest to read the test and source files while they are still typescript without needing to compile them first. This is what karma is having an issue with too, It’s trying to read the test file as javascript and failing.
I have a front end (angular) in one file path, and then in another I have my backend (Koa and Jest). I don’t have Jest going over the front end (because of Karma) So what it sounds like is when circleci reaches the npm test section circleci tells Jest to read Karma’s tests as its own, and interprets it as it’s own. Because I only wrote (in the back end) 2 tests, but when circleci runs the tests I get:
Test Suites: 8 failed, 2 passed, 10 total
Tests: 3 passed, 3 total
Snapshots: 0 total
Time: 3.341s
the 2 passing are the ones that I wrote with Jest for Koa.
@drazisil it works! ALL GREEN!!! Problem
since circleci is running at the top level and jest is set in my package.json as the test dependency, when performing a push to the branch and circleci was running the - npm test from the config.yml file it was telling Jest to run all the tests. And because jest will see the extention .spec.js or .test.js as it’s own file and jest was reading the typescript file as JavaScript
SOLUTION easiest: go to your package.json and add this: