grep-tests-from-pull-requests
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "grep-tests-from-pull-requests", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Grabs the test tags to run from the pull request text", | ||
"main": "index.js", | ||
"main": "src/index.js", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "echo \"Error: no test specified\" && exit 1", |
@@ -5,2 +5,39 @@ # grep-tests-from-pull-requests | ||
## Install | ||
```shell | ||
# add this plugin as a dev dependency using NPM | ||
$ npm i -D grep-tests-from-pull-requests | ||
# or using Yarn | ||
$ yarn add -D grep-tests-from-pull-requests | ||
``` | ||
Register the plugin in your plugins file _before_ [cypress-grep](https://github.com/cypress-io/cypress-grep) registration. | ||
```js | ||
// cypress/plugins/index.js | ||
module.exports = async (on, config) => { | ||
// include this plugin before cypress-grep | ||
// so if we find the test tags in the pull request body | ||
// we can grep for them by setting the grep config | ||
await require('grep-tests-from-pull-requests')(on, config, { | ||
// try to find checkbox lines in the pull request body with these tags | ||
tags: ['@log', '@sanity', '@user'], | ||
// repo with the pull request text to read | ||
owner: 'bahmutov', | ||
repo: 'todomvc-no-tests-vercel', | ||
// to get a private repo above, you might need a personal token | ||
token: process.env.PERSONAL_GH_TOKEN || process.env.GITHUB_TOKEN, | ||
}) | ||
// cypress-grep plugin registration | ||
// IMPORTANT: the config.env object might be modified | ||
// by the above plugins, thus return the config object from this function | ||
return config | ||
} | ||
``` | ||
**Important:** notice the plugin registration is an async function, thus you must await the registration. This makes your plugin file function `async`. Make sure to return the `config` object, as it might be changed by this plugin. | ||
## Small print | ||
@@ -7,0 +44,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9584
82