Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

Commit 171a6c5

Browse files
committed
fix: include the plugin version in the debug logs
1 parent 29e1759 commit 171a6c5

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,23 @@ Cypress.grep('hello', '@smoke', 10)
407407

408408
## Debugging
409409

410-
When debugging a problem, first make sure you are passing the values to the plugin correctly by inspecting the "Settings" tab in the Cypress Desktop GUI screen. You should see the values you have passed in the "Config" object under the `env` property. For example, if I start the Test Runner with
410+
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).
411+
412+
```
413+
# get the cypress-grep version using NPM
414+
$ npm ls cypress-grep
415+
...
416+
└── cypress-grep@2.10.1
417+
# get the cypress-grep version using Yarn
418+
$ yarn why cypress-grep
419+
...
420+
=> Found "cypress-grep@2.10.1"
421+
info Has been hoisted to "cypress-grep"
422+
info This module exists because it's specified in "devDependencies".
423+
...
424+
```
425+
426+
Second, make sure you are passing the values to the plugin correctly by inspecting the "Settings" tab in the Cypress Desktop GUI screen. You should see the values you have passed in the "Config" object under the `env` property. For example, if I start the Test Runner with
411427

412428
```text
413429
$ npx cypress open --env grep=works,grepFilterTests=true
@@ -419,7 +435,7 @@ Then I expect to see the grep string and the "filter tests" flag in the `env` ob
419435

420436
### Log messages
421437

422-
This module uses [debug](https://github.com/visionmedia/debug#readme) to log verbose messages. You can enable the debug messages in the plugin file (runs when discovering specs to filter), and inside the browser to see how it determines which tests to run and to skip.
438+
This module uses [debug](https://github.com/visionmedia/debug#readme) to log verbose messages. You can enable the debug messages in the plugin file (runs when discovering specs to filter), and inside the browser to see how it determines which tests to run and to skip. When opening a new issue, please provide the debug logs from the plugin (if any) and from the browser.
423439

424440
### Debugging in the plugin
425441

src/plugin.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const globby = require('globby')
33
const { getTestNames } = require('find-test-names')
44
const fs = require('fs')
55
const path = require('path')
6+
const { version } = require('../package.json')
67

78
/**
89
* Prints the cypress-grep environment values if any.
@@ -14,6 +15,7 @@ function cypressGrepPlugin(config) {
1415
}
1516

1617
debug('Cypress config env object: %o', config.env)
18+
debug('plugin version %s', version)
1719
const grep = config.env.grep
1820
if (grep) {
1921
console.log('cypress-grep: tests with "%s" in their names', grep.trim())

src/support.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/// <reference path="./index.d.ts" />
33

44
const { parseGrep, shouldTestRun } = require('./utils')
5+
const { version } = require('../package.json')
56
const debug = require('debug')('cypress-grep')
67
debug.log = console.info.bind(console)
78

@@ -31,7 +32,7 @@ function cypressGrep() {
3132

3233
if (!grep && !grepTags && !burnSpecified && !grepUntagged) {
3334
// nothing to do, the user has no specified the "grep" string
34-
debug('Nothing to grep')
35+
debug('Nothing to grep, version %s', version)
3536
return
3637
}
3738

@@ -46,7 +47,7 @@ function cypressGrep() {
4647
const omitFiltered =
4748
Cypress.env('grepOmitFiltered') || Cypress.env('grep-omit-filtered')
4849

49-
debug('grep %o', { grep, grepTags, grepBurn, omitFiltered })
50+
debug('grep %o', { grep, grepTags, grepBurn, omitFiltered, version })
5051
if (!Cypress._.isInteger(grepBurn) || grepBurn < 1) {
5152
throw new Error(`Invalid grep burn value: ${grepBurn}`)
5253
}

0 commit comments

Comments
 (0)