4

I am using jest puppeteer for browser tests. I want to generate documentation around the test names in order to know what all tests I have in my suite.

One test file can have n number of tests. In the below example, i have 2 tests in one js file.

it(
        'Filter orders By Start Date Past 6 Month',
        async () => {
            try {
                await OrderFil.applyFilterOnorders(TestData.FilterByOrders6);

            } catch (err) {
                logger.error(err.stack);
                throw err;
            }
        },
        TEST_TIMEOUT_MS
    ); 

it(
        'Filter orders By Start Date Past 12 Month',
        async () => {
            try {
                await OrderFil.applyFilterOnorders(TestData.FilterByOrders12);

            } catch (err) {
                logger.error(err.stack);
                throw err;
            }
        },
        TEST_TIMEOUT_MS
    ); 

Is there a way to generate the test names from the above file like:

* Filter orders By Start Date Past 6 Month
* Filter orders By Start Date Past 12 Month

If there is some utility or npm package I can use ?

ggorlen
  • 44,755
  • 7
  • 76
  • 106
Saurabh
  • 930
  • 2
  • 17
  • 39

0 Answers0