New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

find-test-names

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-test-names - npm Package Compare versions

Comparing version 1.16.0 to 1.17.0

2

package.json
{
"name": "find-test-names",
"version": "1.16.0",
"version": "1.17.0",
"description": "Given a Mocha / Cypress spec file, returns the list of suite and test names",

@@ -5,0 +5,0 @@ "main": "src",

@@ -68,2 +68,19 @@ # find-test-names [![ci](https://github.com/bahmutov/find-test-names/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bahmutov/find-test-names/actions/workflows/ci.yml)

### filterByEffectiveTags
Once you `setEffectiveTags`, you can filter all tests by an effective tag. For example, to fid all tests with the given tag:
```js
const {
getTestNames,
setEffectiveTags,
filterByEffectiveTags,
} = require('find-test-names')
const result = getTestNames(source, true)
setEffectiveTags(result.structure)
const tests = filterByEffectiveTags(result.structure, ['@one'])
```
Returns individual test objects.
### Bin

@@ -70,0 +87,0 @@

@@ -457,2 +457,17 @@ const babel = require('@babel/parser')

/**
* Visits each individual test in the structure and checks if it
* has any effective tags from the given list.
*/
function filterByEffectiveTags(structure, tags) {
const filteredTests = []
visitEachTest(structure, (test) => {
const hasTag = tags.some((tag) => test.effectiveTags.includes(tag))
if (hasTag) {
filteredTests.push(test)
}
})
return filteredTests
}
function setParentSuite(structure) {

@@ -611,2 +626,3 @@ visitEachNode(structure, (test, parentSuite) => {

setEffectiveTags,
filterByEffectiveTags,
}
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