Socket
Socket
Sign inDemoInstall

mocha-list-tests

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-list-tests - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

18

mocha-list-tests.js

@@ -143,2 +143,15 @@ // -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// captureHookFunctions
//
// Helper function to captures all 'before' 'after' ,... calls and add them to
// our internal list of tests. Since these function's first parameter is a
// function itself, we have to specify the name beforehand
// -----------------------------------------------------------------------------
function captureHookFunctions (name) {
return function capture (ignoreFunction) {
console.log (name, ignoreFunction);
addTestRouteToTree (testRoute, ':' + name);
};
}
// -----------------------------------------------------------------------------
// findSuitesAndTests

@@ -167,2 +180,7 @@ //

global.before = captureHookFunctions('before')
global.after = captureHookFunctions('after')
global.beforeEach = captureHookFunctions('beforeEach')
global.afterEach = captureHookFunctions('afterEach')
// capture all suites and direct tests

@@ -169,0 +187,0 @@ for (let i = 0; i < allTestFiles.length; i++) {

2

package.json
{
"name": "mocha-list-tests",
"version": "1.0.1",
"version": "1.0.2",
"description": "List mocha suites and tests without running anything",

@@ -5,0 +5,0 @@ "main": "mocha-list-tests.js",

# mocha-list-tests
List all mocha suites and tests without running them.
List all mocha suites and tests without running them. Zero dependencies.

@@ -9,3 +9,3 @@ This is a standalone mocha-compatible companion, with no dependencies (not even mocha), to get a parseable json list of all suites and tests that would be executed in a folder.

This script would be useful as long as this functionality is not included in mocha itself. At the time of this writing (2018), there seems to be no motivation to do so, since a patch was submitted in the past and rejected.
This script would be useful as long as this functionality is not included in mocha itself. At the time of this writing (2019), there seems to be no motivation to do so, since a patch was submitted in the past and rejected.

@@ -12,0 +12,0 @@ ## Install

@@ -18,2 +18,15 @@

});
});
describe ('suite-3', async function () {
before( function(){ console.log("won't execute"); });
after( function(){ console.log("won't execute"); });
beforeEach( function(){ console.log("won't execute"); });
afterEach( function(){ console.log("won't execute"); });
it('test-3.1', async function() {
console.log ("won't execute");
});
});
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