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.19.0 to 1.20.0

2

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

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

@@ -91,2 +91,6 @@ # 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)

### findEffectiveTestTags
Returns a single object with full test titles as keys. For each key, the value is the list of effective tags. See the [find-effective-tags.js](./test/find-effective-tags.js) spec file.
### Bin

@@ -93,0 +97,0 @@

@@ -18,4 +18,4 @@ const babel = require('@babel/parser')

const isIt = (node) =>
node.type === 'CallExpression' &&
( node.callee.name === 'it' || node.callee.name === 'specify' )
node.type === 'CallExpression' &&
(node.callee.name === 'it' || node.callee.name === 'specify')

@@ -25,3 +25,3 @@ const isItSkip = (node) =>

node.callee.type === 'MemberExpression' &&
( node.callee.object.name === 'it' || node.callee.object.name === 'specify' ) &&
(node.callee.object.name === 'it' || node.callee.object.name === 'specify') &&
node.callee.property.name === 'skip'

@@ -691,2 +691,29 @@

/** Given the test source code, finds all tests
* and returns a single object with all test titles.
* Each key is the full test title.
* The value is a list of effective tags for this test.
*/
function findEffectiveTestTags(source) {
if (typeof source !== 'string') {
throw new Error('Expected a string source')
}
const result = getTestNames(source, true)
setEffectiveTags(result.structure)
const testTags = {}
visitEachTest(result.structure, (test, parentSuite) => {
// console.log(test)
if (typeof test.fullName !== 'string') {
console.error(test)
throw new Error('Cannot find the full name for test')
}
testTags[test.fullName] = test.effectiveTags
})
// console.log(testTags)
return testTags
}
module.exports = {

@@ -702,2 +729,3 @@ getTestNames,

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