Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grep-tests-from-pull-requests

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grep-tests-from-pull-requests - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc