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
0
Versions
84
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.29.1 to 1.29.2

src/relative-path-resolver.js

8

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

@@ -16,3 +16,3 @@ "main": "src",

"scripts": {
"test": "ava",
"test": "ava --config ava.config.mjs",
"semantic-release": "semantic-release",

@@ -52,7 +52,7 @@ "demo": "DEBUG=find-test-names node bin/find-test-names.js demo/spec.js",

"common-tags": "1.8.2",
"husky": "8.0.3",
"husky": "9.1.7",
"prettier": "3.4.2",
"semantic-release": "24.2.0",
"semantic-release": "24.2.1",
"stop-only": "3.4.2"
}
}

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

const { formatTestList } = require('./format-test-list')
const { resolveImportsInAst } = require('./resolve-imports')
const { relativePathResolver } = require('./relative-path-resolver')

@@ -619,7 +621,7 @@ const isDescribeName = (name) => name === 'describe' || name === 'context'

*/
function filterByEffectiveTags(structure, tags) {
function filterByEffectiveTags(structure, tags, relativeFilename) {
if (typeof structure === 'string') {
// we got passed the input source code
// so let's parse it first
const result = getTestNames(structure, true)
const result = getTestNames(structure, true, relativeFilename)
setEffectiveTags(result.structure)

@@ -669,3 +671,3 @@ return filterByEffectiveTags(result.structure, tags)

*/
function getTestNames(source, withStructure) {
function getTestNames(source, withStructure, currentFilename) {
// should we pass the ecma version here?

@@ -708,2 +710,9 @@ let AST

// first, see if we can resolve any imports
// that resolve as constants
const filePathProvider = relativePathResolver(currentFilename)
debug('constructed file path provider wrt %s', currentFilename)
const resolvedImports = resolveImportsInAst(AST, filePathProvider)
debug('resolved imports %o', resolvedImports)
walk.ancestor(

@@ -911,3 +920,3 @@ AST,

*/
function findEffectiveTestTags(source) {
function findEffectiveTestTags(source, currentFilename) {
if (typeof source !== 'string') {

@@ -917,3 +926,3 @@ throw new Error('Expected a string source')

const result = getTestNames(source, true)
const result = getTestNames(source, true, currentFilename)
setEffectiveTags(result.structure)

@@ -945,3 +954,3 @@

const source = readFileSync(specFilename, 'utf8')
return findEffectiveTestTags(source)
return findEffectiveTestTags(source, specFilename)
}

@@ -948,0 +957,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