2

If there is this file tests/test.test.ts :

describe('test-group', () => {
    it('t1', async() => {
        console.log('t1');
    });
    it('t2', () => {
        console.log('t2');
    });
});

I just want to run the t2 inside, you can do this:

npx jest tests/test.test.ts --testNamePattern="test-group t2"

Separate the levels with spaces.

Related documentation: https://jestjs.io/zh-Hans/docs/cli#--testnamepatternregex


黒之染
3.1k 声望47 粉丝

两年半个人练习生,喜欢ctrl+c/ctrl+v/delete