Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it.skip tests run before() hook #18

Closed
LtMama opened this issue Mar 4, 2021 · 2 comments
Closed

it.skip tests run before() hook #18

LtMama opened this issue Mar 4, 2021 · 2 comments
Assignees
Labels
bug Something isn't working confirmed Successfully replicated

Comments

@LtMama
Copy link

LtMama commented Mar 4, 2021

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

@annaet
Copy link
Contributor

annaet commented Mar 28, 2021

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?

@annaet annaet added the bug Something isn't working label Mar 28, 2021
@annaet annaet self-assigned this Mar 28, 2021
@annaet annaet added the confirmed Successfully replicated label Mar 28, 2021
@annaet annaet closed this as completed Mar 28, 2021
@LtMama
Copy link
Author

LtMama commented Mar 30, 2021

Hey @annaet,

Works a treat, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed Successfully replicated
Projects
None yet
Development

No branches or pull requests

2 participants