Posts

Showing posts with the label jestjs

Jest not finding typescript tests

Jest not finding typescript tests I'm trying to write a jest test but it's giving me an odd error. TypeError: jest_1.it is not a function 9 | 10 | describe('Health check', () => { > 11 | it('GET works', async () => { I'm not sure if posting all the various config files would help so maybe I'll just point out the pieces I'm using: serverless framework with serverless-plugin-typescript plugin, typescript, jest, ts-jest. My understanding is that ts-jest should be compiling the TS for me and then handing it over to Jest. One thing is I know serverless is opinionated about it's TS configuration so maybe that's causing an issue with ts-jest. Any ideas about what I should be looking at? Edit: formatting on code block 1 Answer 1 Figured it out. I had imported it at the top of my test file like so: it import {it} from 'jest' import {it} f...

Jest coverage highlighting in emacs not updating after change

Jest coverage highlighting in emacs not updating after change I have emacs minor mode for jest coverage highlighting and when I change coverage (update my tests) and run this function the highlighting is not updating. (defun jc/mark-buffer () (interactive) (let* ((dir (jc/root-git-repo)) (json-object-type 'hash-table) (json-array-type 'list) (json-key-type 'string) (json (json-read-file (concat dir "/coverage/coverage-final.json"))) (filename (buffer-file-name (current-buffer))) (coverage (gethash filename json)) (statments (gethash "statementMap" coverage))) (save-excursion (let ((coverage-list (gethash "s" coverage)) (covered 0) (not-covered 0)) (maphash (lambda (key value) (if (not (and jc/statements (= (gethash key jc/statements) value))) (let* ((statment (gethash key statments)) ...