grep-tests-from-pull-requests
Advanced tools
Comparing version 1.3.0 to 1.4.0
{ | ||
"name": "grep-tests-from-pull-requests", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Grabs the test tags to run from the pull request text", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -20,2 +20,3 @@ # grep-tests-from-pull-requests | ||
// cypress/plugins/index.js | ||
const pickTestsFromPullRequest = require('grep-tests-from-pull-requests') | ||
module.exports = async (on, config) => { | ||
@@ -25,3 +26,3 @@ // include this plugin before cypress-grep | ||
// we can grep for them by setting the grep config | ||
await require('grep-tests-from-pull-requests')(on, config, { | ||
const pullOptions = { | ||
// try to find checkbox lines in the pull request body with these tags | ||
@@ -34,3 +35,4 @@ tags: ['@log', '@sanity', '@user'], | ||
token: process.env.PERSONAL_GH_TOKEN || process.env.GITHUB_TOKEN, | ||
}) | ||
} | ||
await pickTestsFromPullRequest(on, config, pullOptions) | ||
@@ -59,2 +61,12 @@ // cypress-grep plugin registration | ||
**Tip:** you can control if you want to set the baseUrl based on the pull request text using an option | ||
```js | ||
const pickTestsFromPullRequest = require('grep-tests-from-pull-requests') | ||
const pullOptions = { | ||
..., | ||
setBaseUrl: true // default, use false to disable setting the baseUrl | ||
} | ||
``` | ||
## Resolved value | ||
@@ -65,3 +77,4 @@ | ||
```js | ||
const testsToRun = await require('grep-tests-from-pull-requests')(...) | ||
const pickTestsFromPullRequest = require('grep-tests-from-pull-requests') | ||
const testsToRun = await pickTestsFromPullRequest(...) | ||
if (testsToRun) { | ||
@@ -68,0 +81,0 @@ if (testsToRun.baseUrl) { |
@@ -10,13 +10,2 @@ /// <reference types="cypress" /> | ||
function getContext() { | ||
let context = 'Cypress tests' | ||
if (process.env.CIRCLE_NODE_INDEX && process.env.CIRCLE_NODE_TOTAL) { | ||
// index starts with 0 | ||
const machineIndex = Number(process.env.CIRCLE_NODE_INDEX) + 1 | ||
const totalMachines = Number(process.env.CIRCLE_NODE_TOTAL) | ||
context += ` (machine ${machineIndex}/${totalMachines})` | ||
} | ||
return context | ||
} | ||
/** | ||
@@ -79,4 +68,11 @@ * @param {Cypress.PluginEvents} on Function for registering event handlers | ||
if (testsToRun.baseUrl) { | ||
console.log('setting the baseUrl to %s', testsToRun.baseUrl) | ||
config.baseUrl = testsToRun.baseUrl | ||
if (options.setBaseUrl === false) { | ||
debug( | ||
'skipping setting the baseUrl to %s because setBaseUrl is false', | ||
testsToRun.baseUrl, | ||
) | ||
} else { | ||
console.log('setting the baseUrl to %s', testsToRun.baseUrl) | ||
config.baseUrl = testsToRun.baseUrl | ||
} | ||
} | ||
@@ -83,0 +79,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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
14242
133
4
284