Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Jest's todo feature

The release notes for Jest 24 highlighted a new feature that I want to make use of: test.todo. However, for the life of my I am unable to use it.

For example, I want to sketch out tests in my subscriptions.test.ts file so I create the following:

describe('Subscription Tests', () => {
    test.todo('... a name');
});

The TypeScript compiler then promptly presents me with a red line under todo saying, Property 'todo' does not exist on type 'It'.

I am sure I am missing something obvious but I've hit the wall at this point. Can someone help?

like image 886
Mark Avatar asked Feb 03 '23 19:02

Mark


2 Answers

Thanks to the comment from @jonrsharpe I ran yarn upgrade @types/jest --latest and that resolved my problem. Urgh -- could not see the wood for the trees!

like image 53
Mark Avatar answered Feb 15 '23 17:02

Mark


I feel pretty dumb for a while because my test was failing after adding the todo(). I shoud've read the documentation more thoroughly. Here is my problematic code:

test("should show progress indicator when authorizing", () => {
  test.todo("should show progress indicator when authorizing")
})

But it need to be like the below. Passing callback when using todo and nested test() in the callback are not allowed.

test.todo("should show progress indicator when authorizing")
like image 37
NearHuscarl Avatar answered Feb 15 '23 15:02

NearHuscarl