bahmutov / cy-grep

Filter Cypress tests using title or tags
16 stars 4 forks source link

TypeError: patterns.reduce is not a function #83

Closed MoKhajavi75 closed 1 year ago

MoKhajavi75 commented 1 year ago

Hey @bahmutov Thanks for this tool!

I noticed after some upgrades in fast-glob there is a problem, preventing me from running Cypress. I get:

node_modules/.pnpm/fast-glob@3.3.0/node_modules/fast-glob/out/utils/pattern.js:131:21

exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
  130 | function expandPatternsWithBraceExpansion(patterns) {
> 131 |     return patterns.reduce((collection, pattern) => {
      |                     ^
  132 |         return collection.concat(expandBraceExpansion(pattern));
  133 |     }, []);
  134 | }

Stack Trace:

TypeError: patterns.reduce is not a function
    at Object.expandPatternsWithBraceExpansion (/Users/mohamadkh75/x/node_modules/.pnpm/fast-glob@3.3.0/node_modules/fast-glob/out/utils/pattern.js:131:21)
    at processPatterns (/Users/mohamadkh75/x/node_modules/.pnpm/fast-glob@3.3.0/node_modules/fast-glob/out/managers/tasks.js:27:34)
    at Object.generate (/Users/mohamadkh75/x/node_modules/.pnpm/fast-glob@3.3.0/node_modules/fast-glob/out/managers/tasks.js:7:20)
    at getWorks (/Users/mohamadkh75/x/node_modules/.pnpm/fast-glob@3.3.0/node_modules/fast-glob/out/index.js:91:31)
    at AsyncFunction.sync (/Users/mohamadkh75/x/node_modules/.pnpm/fast-glob@3.3.0/node_modules/fast-glob/out/index.js:23:23)
    at AsyncFunction.module.exports.sync (/Users/mohamadkh75/x/node_modules/.pnpm/globby@11.1.0/node_modules/globby/index.js:151:42)
    at findCypressSpecsV10 (/Users/mohamadkh75/x/node_modules/.pnpm/find-cypress-specs@1.34.5_@babel+core@7.22.8_@types+node@18.16.19_typescript@5.1.6/node_modules/find-cypress-specs/src/index.js:150:24)
    at findCypressSpecs (/Users/mohamadkh75/x/node_modules/.pnpm/find-cypress-specs@1.34.5_@babel+core@7.22.8_@types+node@18.16.19_typescript@5.1.6/node_modules/find-cypress-specs/src/index.js:233:21)
    at getSpecs (/Users/mohamadkh75/x/node_modules/.pnpm/find-cypress-specs@1.34.5_@babel+core@7.22.8_@types+node@18.16.19_typescript@5.1.6/node_modules/find-cypress-specs/src/index.js:210:10)
    at cypressGrepPlugin (/Users/mohamadkh75/x/node_modules/.pnpm/@bahmutov+cy-grep@1.9.16_@babel+core@7.22.8_@types+node@18.16.19_cypress@12.17.0_typescript@5.1.6/node_modules/@bahmutov/cy-grep/src/plugin.js:79:21)
    at setupNodeEvents (file:///Users/mohamadkh75/x/cypress/config/base.ts:50:7)
    at /Users/mohamadkh75/Library/Caches/Cypress/12.17.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:122:14
    at tryCatcher (/Users/mohamadkh75/Library/Caches/Cypress/12.17.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Users/mohamadkh75/Library/Caches/Cypress/12.17.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/method.js:39:29)
    at RunPlugins.load (/Users/mohamadkh75/Library/Caches/Cypress/12.17.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:119:9)
    at RunPlugins.runSetupNodeEvents (/Users/mohamadkh75/Library/Caches/Cypress/12.17.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:59:17)
    at EventEmitter. (/Users/mohamadkh75/Library/Caches/Cypress/12.17.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:185:22)
    at EventEmitter.emit (node:events:513:28)
    at EventEmitter.emit (node:domain:489:12)
    at process. (/Users/mohamadkh75/Library/Caches/Cypress/12.17.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:33:22)
    at process.emit (node:events:513:28)
    at process.emit (node:domain:489:12)

I have to pin to fast-glob@3.2.12.

Any idea?

brendaneross commented 1 year ago

Seeing the same thing.

MoKhajavi75 commented 1 year ago

Fixed by https://github.com/bahmutov/find-cypress-specs/pull/168