Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import unfetch from 'unfetch'

export function checkMountModeEnabled() {
// @ts-ignore
if (Cypress.spec.specType !== 'component') {
const specType = Cypress?.spec?.specType // this will be present for cypress@6.x, but not for cypress@7.x
if (specType != null && specType !== 'component') {
Comment on lines +6 to +7
Copy link

@nwaughachukwuma nwaughachukwuma Aug 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bahmutov, Cypress.spec.specType is undefined here and it may suffice to use Cypress.testingType

cc @JohnnyFun

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another angle is that Cypress may no longer provide the specType attribute since it now has dedicated commands for component testing, open-ct and run-ct. And looking at the output from here, also shown below, it is safe to use Cypress.testingType

it('log spec info', () => {
  console.log(Cypress.spec)
  // {
  //   name: 'filter.spec.js',
  //   relative: 'cypress/integration/filter.spec.js',
  //   absolute: '/Users/janelane/Dev/web-app/cypress/integration/filter.spec.js',
  // }
})

throw new Error(
`In order to use mount or unmount functions please place the spec in component folder`,
)
Expand Down