What is the difference between 'it' and 'test' in Jest?

后端 未结 7 1976
滥情空心
滥情空心 2021-01-29 20:12

I have two tests in my test group. One of the tests use it and the other one uses test. Both of them seem to be working very similarly. What is the dif

7条回答
  •  闹比i
    闹比i (楼主)
    2021-01-29 20:49

    They are the same thing. I am using TypeScript as the programming language, and when I look into the definition file from the Jest package source code from /@types/jest/index.d.ts, I can see the following code.

    Obviously, there are lots of different names of 'test', and you can use any of them.

    declare var beforeAll: jest.Lifecycle;
    declare var beforeEach: jest.Lifecycle;
    declare var afterAll: jest.Lifecycle;
    declare var afterEach: jest.Lifecycle;
    declare var describe: jest.Describe;
    declare var fdescribe: jest.Describe;
    declare var xdescribe: jest.Describe;
    declare var it: jest.It;
    declare var fit: jest.It;
    declare var xit: jest.It;
    declare var test: jest.It;
    declare var xtest: jest.It;

提交回复
热议问题