Skip to content

Can't use mocha functions like skip() in itParam() #6

Closed
@tstoppe89

Description

@tstoppe89

Hi!

I currently want to skip tests in runtime, so I just want to use the skip function of mocha, but it doesn't work with itParam.

my code snippet:

import "mocha";
import * as itParam from "mocha-param";
import { expect } from "chai";
...
describe("Test_XYZ", function() {
  ...
  const iterationData = [....];
  ..
  itParam("MyTest_${value.shortName}", iterationData, async function(data) {
    if(condition)this.skip();
    await someAsyncAssertMethod(data.number);
  });
});

^ don't wonder, this is just example code :).

This throws the following error:
TypeError: Cannot read property 'skip' of undefined

Is there some workaround to access those mocha functions like skip, retries etc. ?

cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions