Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

@cypress/skip-test can't be imported #103

Closed
mellis481 opened this issue Sep 30, 2020 · 1 comment
Closed

@cypress/skip-test can't be imported #103

mellis481 opened this issue Sep 30, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@mellis481
Copy link

The docs describe being able to import skipOn and onlyOn like this:

import { onlyOn, skipOn } from '@cypress/skip-test'

it('runs only on Mac', () => {
  // using the exported function instead of
  // the custom command cy.onlyOn(...)
  onlyOn('mac')
})

it('skips on Mac', () => {
  skipOn('darwin')
})

This doesn't work (at least in Typescript) because node_modules/@cypress/skip-test/index.d.ts is not a module; it's just the Cypress overrides.

@annaet
Copy link

annaet commented Oct 29, 2020

This is a duplicate of #91.

I fixed this by creating a file called modules.d.ts and declaring the module in there:

declare module '@cypress/skip-test';

Then you can just reference that in any file using:

/// <reference path='../../support/modules.d.ts' />

@jennifer-shehane jennifer-shehane added the duplicate This issue or pull request already exists label Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants