Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fatso83/mini-mocha

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fatso83/mini-mocha - npm Package Compare versions

Comparing version 2.1.3 to 2.2.0

lib/executor.js

45

index.js
const { assertFunction, assertTitle } = require("./lib/util");
const { queueHandler, taskQueue, taskType, taskAddedEventName } = require("./lib/queue");
const { metaData } = require("./lib/execute");
const { Processor, TASK_TYPE, TASK_ADDED_EVENT_NAME } = require("./lib/processor");
const { META_DATA } = require("./lib/executor");
const { DefaultReporter, RunKitReporter } = require("./lib/reporters");

@@ -18,3 +19,3 @@ /**

assertFunction(fn);
after.caller[metaData].afterHook = fn;
after.caller[META_DATA].afterHook = fn;
}

@@ -24,3 +25,3 @@

assertFunction(fn);
afterEach.caller[metaData].afterEachHookCollection.push(fn);
afterEach.caller[META_DATA].afterEachHookCollection.push(fn);
}

@@ -30,3 +31,3 @@

assertFunction(fn);
before.caller[metaData].beforeHook = fn;
before.caller[META_DATA].beforeHook = fn;
}

@@ -36,3 +37,3 @@

assertFunction(fn);
beforeEach.caller[metaData].beforeEachHookCollection.push(fn);
beforeEach.caller[META_DATA].beforeEachHookCollection.push(fn);
}

@@ -44,3 +45,3 @@

fn[metaData] = {
fn[META_DATA] = {
title,

@@ -55,11 +56,11 @@ afterHook: null,

if (describe.caller && describe.caller[metaData]) {
describe.caller[metaData].fns.push(fn);
if (describe.caller && describe.caller[META_DATA]) {
describe.caller[META_DATA].fns.push(fn);
} else {
taskQueue.push({
type: taskType.describe,
this.processor.queue.push({
type: TASK_TYPE.describe,
fn
});
queueHandler.emit(taskAddedEventName);
this.processor.emit(TASK_ADDED_EVENT_NAME);
}

@@ -72,6 +73,6 @@ }

const caller = it.caller ? it.caller[metaData] : undefined;
const caller = it.caller ? it.caller[META_DATA] : undefined;
if (!caller) {
taskQueue.push({
type: taskType.it,
this.processor.queue.push({
type: TASK_TYPE.it,
title,

@@ -81,3 +82,3 @@ fn

queueHandler.emit(taskAddedEventName);
this.processor.emit(TASK_ADDED_EVENT_NAME);
} else {

@@ -92,5 +93,11 @@ caller.itCollection.push({

module.exports = {
install: function install() {
global.describe = describe;
global.it = it;
install: function install(isRunKit = false) {
const reporter = isRunKit ? RunKitReporter : DefaultReporter;
const processor = Processor.getProcessor(reporter);
global.describe = describe.bind({
processor
});
global.it = it.bind({
processor
});
global.after = after;

@@ -97,0 +104,0 @@ global.afterEach = afterEach;

const assert = require("assert");
const { promisify } = require("util");
function log(title, errMessage = "", justTitle = false) {
const status = errMessage ? `❌` : "✔️ ";
if (justTitle) {
console.log(title);
} else {
console.log(`${status} ${title}${errMessage && ` (Failed with: "${errMessage}")`}`);
}
}
function isAsync(fn) {

@@ -45,3 +35,2 @@ return !!(fn.constructor && fn.constructor.name === "AsyncFunction");

assertTitle,
log,
isAsync,

@@ -48,0 +37,0 @@ isCallbackFunction,

{
"name": "@fatso83/mini-mocha",
"version": "2.1.3",
"version": "2.2.0",
"description": "A minimal emulation of Mocha",

@@ -12,2 +12,3 @@ "main": "index.js",

"fixup": "prettier --write *.js",
"lint": "echo Linting not setup",
"test": "run-p test:*",

@@ -33,2 +34,5 @@ "test:output": "node test/tests.js",

},
"dependencies": {
"@runkit/value-viewer": "1.0.0"
},
"devDependencies": {

@@ -35,0 +39,0 @@ "husky": "^2.3.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