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.2.0 to 1.2.1

2

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

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

@@ -27,2 +27,12 @@ const acorn = require('acorn')

// extracts the test name from the literal or template literal node
const extractTestName = (node) => {
if (node.type === 'TemplateLiteral') {
return node.quasis.map((q) => q.value.cooked.trim()).join(' ')
} else if (node.type === 'Literal') {
return node.value
}
throw new Error(`Unsupported node type: ${node.type}`)
}
/**

@@ -51,4 +61,5 @@ * Returns all suite and test names found in the given JavaScript

if (isDescribe(node)) {
const name = extractTestName(node.arguments[0])
const suiteInfo = {
name: node.arguments[0].value,
name,
}

@@ -60,7 +71,8 @@

}
suiteNames.push(suiteInfo.name)
suiteNames.push(name)
tests.push(suiteInfo)
} else if (isIt(node)) {
const name = extractTestName(node.arguments[0])
const testInfo = {
name: node.arguments[0].value,
name,
}

@@ -72,3 +84,3 @@

}
testNames.push(testInfo.name)
testNames.push(name)
tests.push(testInfo)

@@ -75,0 +87,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