Pass jest cla via d2-app-scripts test

Greetings :wave:

I’m trying to test a specific test in my DHIS2 app platform web app, if I were using jest directly I would select to run the specific test with:
jest -t 'test name'

However this does not seem to work with yarn test in my dhis2 app platform app. It just ignores this parameter and runs everything. In some cases I read you can pass a parameter through to jest by adding -- after yarn test, but this does not seem to work either.

Any help much appreciated!
Pete

Hi Pete!

This was just fixed by @kpvandivier yesterday :tada:, you should be able to upgrade the version of @dhis2/cli-app-scripts to latest and then passing a positional argument (yarn test <test name or pattern>) should work

Available in DHIS2 App Platform version 10.2.2
See this PR

3 Likes

Hi @austin thanks for this! testRegex only seems to allow me to select entire files rather than groups or individual tests within a file. I am just hoping to pass the parameter testNamePatternRegex through to jest.

1 Like

Ah got it - yeah, we might want to look into supporting additional jest parameters like -t but currently we only support filtering by file name

3 Likes

Good to know, thanks for confirming!

2 Likes