infosum/cypress-tags

it.skip tests run before() hook

Closed this issue · 2 comments

Running with CYPRESS_INCLUDE_TAGS, any test that includes a it.skip() but not the included tag has it's relevant before() hook run, before quitting and showing as Pending in results output

describe('This is a test', () => {
  before(() => {
    cy.log('before run');
  });

  beforeEach(() => {
    cy.log('beforeEach run');
  });

  it.skip('This shouldn\'t run', () => {
    cy.log('Test Run');
  });
});

Running the following:

CYPRESS_INCLUDE_TAGS=@smoke ./node_modules/.bin/cypress run --browser chrome --spec cypress/integration/test_*.spec.js

runs 3 files: test_nonskip.spec.js, test_skip.spec.js, test_smoke.spec.js. These are essentially the same code as above where nonskip = it(), skip = it.skip(), smoke = it(['@smoke'])

This outputs:
Screenshot 2021-03-04 at 13 55 44

I would expect test_skip to behave the same as test_nonskip

Hi @LtMama,

This is an interesting issue as it highlights the difference between how this library and Cypress treat skipped tests.

If you see this issue: cypress-io/cypress#3092, then you see that it is a Cypress feature (or bug depending who you ask) to mark skipped tests as pending. There is some debate on that ticket as to whether this is just a terminology issue or whether a change should be made to not show skipped tests as pending.

I have a fix in v0.0.21 that will ensure that .skip tests are ignored using their tags (or lack thereof) to be consistent with how this library skips other untagged tests.

Would you be able to try out the new version and let me know if that works for you?

Hey @annaet,

Works a treat, thanks!