cypress-grep icon indicating copy to clipboard operation
cypress-grep copied to clipboard

parseGrep is not a function

Open kapilchokhawala opened this issue 3 years ago • 4 comments

Hi Team,

I installed cypress-grep in my project and I am getting the said error.

Steps that I followed:

  1. ./pnpm i -D cypress-grep
  2. I have this line at line 1 require('cypress-grep')(); of file /support/index.js
  3. I have this line in /plugins/index.js module.exports = (on, config) => { require('cypress-grep/src/plugin')(config)
  4. I am using only 1 spec file out of 10 that I have. In that 1 spec file, I am tagging only 2 tests out of 23 other tests. it('C5769093 - User should be able to turn on/off sharing for the action plan', { tags: '@smokeTest' }, function () { it('C5769092 - User should be able to open "Share Action Plan" drawer via "Share" button on the builder view', { tags: '@smokeTest' }, function () {
  5. scripts in package.json "e2e.run.smokeTest": "cypress run --headless --browser chrome --env grepTags=@smokeTest",
  6. from command line I am running this command ./pnpm run e2e.run.smokeTest

It's a big project with lot of dependencies and devDependencies. Most related to cypress, I have the following installed "cypress": "8.5.0", "cypress-grep": "^2.5.3", "cypress-multi-reporters": "1.1.22", "cypress-pipe": "^2.0.0", "cypress-wait-until": "^1.7.1",

image

kapilchokhawala avatar Oct 01 '21 20:10 kapilchokhawala

so just for fun, in cypress-grep/src/support.js I moved line 4 const { parseGrep, shouldTestRun } = require('./utils') inside cypressGrep function.

then it threw me an error

Module parse failed: Unexpected token (16:57)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|  */
| function cypressGrep() {
>   const { parseGrep, shouldTestRun } = require('./utils')e test title go grep */
|   let grep = Cypress.env('grep')
|   if (grep) {
    at Watching.handle [as handler] (/Users/kapil.chokhawala/Library/Caches/Cypress/8.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-preprocessor/dist/index.js:176:23)```
           

not sure if that's technically right but is it that when it is were it is, webpack isn't processing that line and fails to throw the errror? 

kapilchokhawala avatar Oct 04 '21 00:10 kapilchokhawala

Can you provide a repo that shows this problem? What if you use npm install or yarn install?

Sent from my iPhone

On Oct 3, 2021, at 20:23, Kapil Chokhawala @.***> wrote:

 so just for fun, in cypress-grep/src/support.js I moved line 4 const { parseGrep, shouldTestRun } = require('./utils') inside cypressGrep function.

then it threw me an error

Module parse failed: Unexpected token (16:57) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | */ | function cypressGrep() {

const { parseGrep, shouldTestRun } = require('./utils')e test title go grep / | let grep = Cypress.env('grep') | if (grep) { at Watching.handle [as handler] @.**/webpack-preprocessor/dist/index.js:176:23)```

not sure if that's technically right but is it that when it is were it is, webpack isn't processing that line and fails to throw the errror? 

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

bahmutov avatar Oct 04 '21 00:10 bahmutov

Hi @bahmutov , I am working in my work repo, so won't be able to share. and I just tried npm, it is throwing an error image

kapilchokhawala avatar Oct 04 '21 13:10 kapilchokhawala

@kapilchokhawala the point of a reproduction is to show the error in the smallest app possible. So you don't need to share your work repo, but create a new one that shows only the error. You can start with https://github.com/cypress-io/cypress-test-tiny

Narretz avatar Oct 22 '21 09:10 Narretz

We are in the process of deprecating this repo as this package has been republished under @cypress/grep and has moved to https://github.com/cypress-io/cypress/tree/develop/npm/grep. I'm going to go ahead and close this issue as it appears stale. If this is still an issue, please open a new issue here

jordanpowell88 avatar Oct 28 '22 19:10 jordanpowell88