Hello,
I try to upgrade from Cypress@9.6.1 to Cypress@10.3.1, but I am getting following error
Could anybody help please?
Stack trace
ReferenceError: it is not defined
at Object. (C:\Users\user\Documents\work\project\node_modules\cypress-grep\src\support.js:10:13)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Object.require.extensions. [as .js] (C:\Users\user\AppData\Local\Cypress\Cache\10.3.1\Cypress\resources\app\node_modules\ts-node\src\index.ts:1445:43)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\user\Documents\work\project\cypress\support\e2e.ts:21:1)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Module.m._compile (C:\Users\user\AppData\Local\Cypress\Cache\10.3.1\Cypress\resources\app\node_modules\ts-node\src\index.ts:1455:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Object.require.extensions. [as .ts] (C:\Users\user\AppData\Local\Cypress\Cache\10.3.1\Cypress\resources\app\node_modules\ts-node\src\index.ts:1458:12)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
...
import registerCypressGrep from 'cypress-grep'
registerCypressGrep()
...
cypress.config.ts
import { defineConfig } from 'cypress'
export default defineConfig({
screenshotsFolder: 'cypress_screenshots',
screenshotOnRunFailure: true,
defaultCommandTimeout: 35000,
pageLoadTimeout: 120000,
viewportWidth: 375,
viewportHeight: 667,
chromeWebSecurity: false,
projectId: 'xxxx',
retries: 1,
video: false,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents (on, config) {
require('cypress-grep/src/plugin')(config)
require('./cypress/plugins/index.js')(on, config)
return config
},
specPattern: 'specs/**/*.{js,jsx,ts,tsx}',
baseUrl: 'https://www.example.com/'
}
})
cypress/plugins/index.js
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
require('cypress-grep/src/plugin')(config)
on('task', {
log (message) {
console.log(message)
return null
}
})
return config
}
This issue doesn't bother me anymore. I'm not exactly sure how I solved that but I was going by approach to create new Cypress project and then adding code from current project per partes.
Hello, I try to upgrade from Cypress@9.6.1 to Cypress@10.3.1, but I am getting following error
Could anybody help please?
Stack trace
package.json
tsconfig.json
cypress/support/e2e.ts
cypress.config.ts
cypress/plugins/index.js