From c5c318f110702f57d72814d8018d84fc306a1183 Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 14 Mar 2023 13:50:14 -0400 Subject: [PATCH 1/2] fix(grep): references to cypress-grep --- npm/grep/README.md | 48 ++++++++++++++++++++--------------------- npm/grep/src/plugin.js | 20 ++++++++--------- npm/grep/src/support.js | 6 +++--- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/npm/grep/README.md b/npm/grep/README.md index 7d586849d0e4..adc147023b27 100644 --- a/npm/grep/README.md +++ b/npm/grep/README.md @@ -19,7 +19,7 @@ All other tests will be marked pending, see why in the [Cypress test statuses](h If you have multiple spec files, all specs will be loaded, and every test will be filtered the same way, since the grep is run-time operation and cannot eliminate the spec files without loading them. If you want to run only specific tests, use the built-in [--spec](https://on.cypress.io/command-line#cypress-run-spec-lt-spec-gt) CLI argument. -Watch the video [intro to cypress-grep plugin](https://www.youtube.com/watch?v=HS-Px-Sghd8) +Watch the video [intro to @cypress/grep plugin](https://www.youtube.com/watch?v=HS-Px-Sghd8) Table of Contents @@ -499,18 +499,18 @@ Cypress.grep('hello', '@smoke', 10) ## Debugging -When debugging a problem, first make sure you are using the expected version of this plugin, as some features might be only available in the [later releases](https://github.com/cypress-io/cypress-grep/releases). +When debugging a problem, first make sure you are using the expected version of this plugin, as some features might be only available in the [later releases](https://www.npmjs.com/package/@cypress/grep?activeTab=versions). ``` -# get the cypress-grep version using NPM -$ npm ls cypress-grep +# get the @cypress/grep version using NPM +$ npm ls @cypress/grep ... -└── cypress-grep@2.10.1 -# get the cypress-grep version using Yarn -$ yarn why cypress-grep +└── @cypress/grep@2.10.1 +# get the @cypress/grep version using Yarn +$ yarn why @cypress/grep ... -=> Found "cypress-grep@2.10.1" -info Has been hoisted to "cypress-grep" +=> Found "@cypress/grep@3.1.0" +info Has been hoisted to "@cypress/grep" info This module exists because it's specified in "devDependencies". ... ``` @@ -531,30 +531,30 @@ This module uses [debug](https://github.com/visionmedia/debug#readme) to log ver ### Debugging in the plugin -Start Cypress with the environment variable `DEBUG=cypress-grep`. You will see a few messages from this plugin in the terminal output: +Start Cypress with the environment variable `DEBUG=@cypress/grep`. You will see a few messages from this plugin in the terminal output: ``` -$ DEBUG=cypress-grep npx cypress run --env grep=works,grepFilterSpecs=true -cypress-grep: tests with "works" in their names -cypress-grep: filtering specs using "works" in the title - cypress-grep Cypress config env object: { grep: 'works', grepFilterSpecs: true } +$ DEBUG=@cypress/grep npx cypress run --env grep=works,grepFilterSpecs=true +@cypress/grep: tests with "works" in their names +@cypress/grep: filtering specs using "works" in the title +@cypress/grep Cypress config env object: { grep: 'works', grepFilterSpecs: true } ... - cypress-grep found 1 spec files +5ms - cypress-grep [ 'spec.js' ] +0ms - cypress-grep spec file spec.js +5ms - cypress-grep suite and test names: [ 'hello world', 'works', 'works 2 @tag1', + @cypress/grep found 1 spec files +5ms + @cypress/grep [ 'spec.js' ] +0ms + @cypress/grep spec file spec.js +5ms + @cypress/grep suite and test names: [ 'hello world', 'works', 'works 2 @tag1', 'works 2 @tag1 @tag2', 'works @tag2' ] +0ms - cypress-grep found "works" in 1 specs +0ms - cypress-grep [ 'spec.js' ] +0ms + @cypress/grep found "works" in 1 specs +0ms + @cypress/grep [ 'spec.js' ] +0ms ``` ### Debugging in the browser -To enable debug console messages in the browser, from the DevTools console set `localStorage.debug='cypress-grep'` and run the tests again. +To enable debug console messages in the browser, from the DevTools console set `localStorage.debug='@cypress/grep'` and run the tests again. ![Debug messages](./images/debug.png) -To see how to debug this plugin, watch the video [Debug cypress-grep Plugin](https://youtu.be/4YMAERddHYA). +To see how to debug this plugin, watch the video [Debug @cypress/grep Plugin](https://youtu.be/4YMAERddHYA). ## Examples @@ -595,11 +595,11 @@ The above scenario was confusing - did you want to find all tests with title con ### from v2 to v3 -Version >= 3 of cypress-grep _only_ supports Cypress >= 10. +Version >= 3 of @cypress/grep _only_ supports Cypress >= 10. ## Small Print License: MIT - do anything with the code, but don't blame me if it does not work. Support: if you find any problems with this module, email / tweet / -[open issue](https://github.com/cypress-io/cypress/issues) on Github +[open issue](https://github.com/cypress-io/cypress/issues) on Github \ No newline at end of file diff --git a/npm/grep/src/plugin.js b/npm/grep/src/plugin.js index ddd35720b2c6..39923691b919 100644 --- a/npm/grep/src/plugin.js +++ b/npm/grep/src/plugin.js @@ -1,4 +1,4 @@ -const debug = require('debug')('cypress-grep') +const debug = require('debug')('@cypress/grep') const globby = require('globby') const { getTestNames } = require('find-test-names') const fs = require('fs') @@ -6,7 +6,7 @@ const { version } = require('../package.json') const { parseGrep, shouldTestRun } = require('./utils') /** - * Prints the cypress-grep environment values if any. + * Prints the @cypress/grep environment values if any. * @param {Cypress.ConfigOptions} config */ function cypressGrepPlugin (config) { @@ -18,23 +18,23 @@ function cypressGrepPlugin (config) { if (!config.specPattern) { throw new Error( - 'Incompatible versions detected, cypress-grep 3.0.0+ requires Cypress 10.0.0+', + 'Incompatible versions detected, @cypress/grep 3.0.0+ requires Cypress 10.0.0+', ) } - debug('cypress-grep plugin version %s', version) + debug('@cypress/grep plugin version %s', version) debug('Cypress config env object: %o', env) const grep = env.grep ? String(env.grep) : undefined if (grep) { - console.log('cypress-grep: tests with "%s" in their names', grep.trim()) + console.log('@cypress/grep: tests with "%s" in their names', grep.trim()) } const grepTags = env.grepTags || env['grep-tags'] if (grepTags) { - console.log('cypress-grep: filtering using tag(s) "%s"', grepTags) + console.log('@cypress/grep: filtering using tag(s) "%s"', grepTags) const parsedGrep = parseGrep(null, grepTags) debug('parsed grep tags %o', parsedGrep.tags) @@ -43,19 +43,19 @@ function cypressGrepPlugin (config) { const grepBurn = env.grepBurn || env['grep-burn'] || env.burn if (grepBurn) { - console.log('cypress-grep: running filtered tests %d times', grepBurn) + console.log('@cypress/grep: running filtered tests %d times', grepBurn) } const grepUntagged = env.grepUntagged || env['grep-untagged'] if (grepUntagged) { - console.log('cypress-grep: running untagged tests') + console.log('@cypress/grep: running untagged tests') } const omitFiltered = env.grepOmitFiltered || env['grep-omit-filtered'] if (omitFiltered) { - console.log('cypress-grep: will omit filtered tests') + console.log('@cypress/grep: will omit filtered tests') } const { specPattern, excludeSpecPattern } = config @@ -78,7 +78,7 @@ function cypressGrepPlugin (config) { let greppedSpecs = [] if (grep) { - console.log('cypress-grep: filtering specs using "%s" in the title', grep) + console.log('@cypress/grep: filtering specs using "%s" in the title', grep) const parsedGrep = parseGrep(grep) debug('parsed grep %o', parsedGrep) diff --git a/npm/grep/src/support.js b/npm/grep/src/support.js index 5fd42b5db588..8797d6786990 100644 --- a/npm/grep/src/support.js +++ b/npm/grep/src/support.js @@ -14,7 +14,7 @@ const _describe = describe /** * Wraps the "it" and "describe" functions that support tags. - * @see https://github.com/cypress-io/cypress-grep + * @see https://github.com/cypress-io/cypress/tree/develop/npm/grep */ function cypressGrep () { /** @type {string} Part of the test title go grep */ @@ -63,7 +63,7 @@ function cypressGrep () { // prevent multiple registrations // https://github.com/cypress-io/cypress-grep/issues/59 if (it.name === 'itGrep') { - debug('already registered cypress-grep') + debug('already registered @cypress/grep') return } @@ -228,7 +228,7 @@ if (!Cypress.grep) { * // remove all current grep settings * // and run all tests * Cypress.grep() - * @see "Grep from DevTools console" https://github.com/cypress-io/cypress-grep#devtools-console + * @see "Grep from DevTools console" https://github.com/cypress-io/cypress/tree/develop/npm/grep#devtools-console */ Cypress.grep = function grep (grep, tags, burn) { Cypress.env('grep', grep) From f249865c692d67929aed5df5e36372292b89813d Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 14 Mar 2023 13:50:52 -0400 Subject: [PATCH 2/2] Update npm/grep/README.md Co-authored-by: Emily Rohrbough --- npm/grep/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/grep/README.md b/npm/grep/README.md index adc147023b27..4675a83c885b 100644 --- a/npm/grep/README.md +++ b/npm/grep/README.md @@ -602,4 +602,4 @@ Version >= 3 of @cypress/grep _only_ supports Cypress >= 10. License: MIT - do anything with the code, but don't blame me if it does not work. Support: if you find any problems with this module, email / tweet / -[open issue](https://github.com/cypress-io/cypress/issues) on Github \ No newline at end of file +[open issue](https://github.com/cypress-io/cypress/issues) on Github. \ No newline at end of file