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

japa

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

japa - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

1

build/src/Assert/index.js

@@ -27,2 +27,3 @@ "use strict";

constructor() {
// config.includeStack = true
this._counts = 0;

@@ -29,0 +30,0 @@ this._plannedCounts = 0;

10

build/src/Reporter/list.d.ts
/**
* @module Core
*/
/// <reference types="node" />
import { EventEmitter } from 'events';
/**

@@ -10,3 +12,3 @@ * List reporter to show the tests progress on stdout in

private _store;
constructor(emitter: any);
constructor(emitter: EventEmitter);
private get _indent();

@@ -54,6 +56,10 @@ /**

/**
* Cleans up the error stack
*/
private _cleanupErrorStack;
/**
* Returns the error stack by filtering the japa core
* lines from it.
*/
private _getStack;
private _formatErrorStack;
/**

@@ -60,0 +66,0 @@ * When test runner stops

@@ -20,3 +20,3 @@ "use strict";

const right_pad_1 = __importDefault(require("right-pad"));
const variable_diff_1 = __importDefault(require("variable-diff"));
const jest_diff_1 = __importDefault(require("jest-diff"));
const utils_1 = require("../utils");

@@ -107,9 +107,16 @@ const Contracts_1 = require("../Contracts");

if (actual && expected) {
console.log(chalk_1.default.red(` Assertion Error: ${error.message}`));
variable_diff_1.default(actual, expected).text.split('\n').forEach((line) => {
console.log(` ${line}`);
});
const diff = jest_diff_1.default(expected, actual);
const mainLine = this._cleanupErrorStack(error.stack)[1];
if (mainLine) {
console.log(chalk_1.default.dim(` source => ${mainLine.trim().replace(/at\s+/, '')}`));
}
if (diff) {
console.log(diff);
}
else {
console.log(chalk_1.default.red(` Assertion Error: ${error.message}`));
}
return;
}
console.log(` ${this._getStack(error.stack)}`);
console.log(` ${this._formatErrorStack(error.stack)}`);
}

@@ -150,7 +157,9 @@ /**

/**
* Returns the error stack by filtering the japa core
* lines from it.
* Cleans up the error stack
*/
_getStack(errorStack) {
_cleanupErrorStack(errorStack) {
let prevIsNative = false;
if (!errorStack) {
return [];
}
return errorStack

@@ -164,4 +173,13 @@ .split('\n')

return !prevIsNative;
})
.map((line, index) => {
});
}
/**
* Returns the error stack by filtering the japa core
* lines from it.
*/
_formatErrorStack(errorStack) {
if (!errorStack) {
return;
}
return this._cleanupErrorStack(errorStack).map((line, index) => {
if (index === 0) {

@@ -171,4 +189,3 @@ return chalk_1.default.red(line);

return chalk_1.default.dim(line);
})
.join('\n');
}).join('\n');
}

@@ -211,3 +228,3 @@ /**

const failedHook = failedHooks[0];
console.log(`${chalk_1.default.red(` (${failedHook.title})`)} ${this._getStack(failedHook.error.stack)}`);
console.log(`${chalk_1.default.red(` (${failedHook.title})`)} ${this._formatErrorStack(failedHook.error.stack)}`);
}

@@ -214,0 +231,0 @@ if (failedTests.length) {

{
"name": "japa",
"version": "3.1.0",
"version": "3.1.1",
"description": "Lean test runner for Node.js",

@@ -43,7 +43,7 @@ "main": "build/index.js",

"is-ci": "^2.0.0",
"jest-diff": "^26.0.1",
"ms": "^2.1.2",
"retry": "^0.12.0",
"right-pad": "^1.0.1",
"time-span": "^4.0.0",
"variable-diff": "^2.0.1"
"time-span": "^4.0.0"
},

@@ -50,0 +50,0 @@ "devDependencies": {

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