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 2.0.9 to 2.0.10

9

build/src/Runner/index.d.ts

@@ -0,4 +1,5 @@

/// <reference types="node" />
import { IOptions } from '../Contracts';
import { Group } from '../Group';
declare type IRunnerHook<T extends any[], H extends any[]> = ((runner: Runner<T, H>, emitter: any) => Promise<void>);
import { EventEmitter } from 'events';
export declare class Runner<T extends any[], H extends any[]> {

@@ -8,10 +9,6 @@ private _groups;

private _reporterFn;
private _hooks;
constructor(_groups: Group<T, H>[], _options: IOptions);
readonly hasErrors: boolean;
reporter(fn: (emitter: any) => void): this;
before(fn: IRunnerHook<T, H>): this;
after(fn: IRunnerHook<T, H>): this;
reporter(fn: (emitter: EventEmitter) => void): this;
run(): Promise<void>;
}
export {};

@@ -10,6 +10,2 @@ "use strict";

this._options = _options;
this._hooks = {
before: [],
after: [],
};
}

@@ -24,12 +20,2 @@ get hasErrors() {

}
before(fn) {
ow_1.default(fn, 'callback', ow_1.default.function);
this._hooks.before.push(fn);
return this;
}
after(fn) {
ow_1.default(fn, 'callback', ow_1.default.function);
this._hooks.after.push(fn);
return this;
}
async run() {

@@ -39,5 +25,2 @@ if (typeof (this._reporterFn) !== 'function') {

}
for (let hook of this._hooks.before) {
await hook(this, Emitter_1.emitter);
}
this._reporterFn(Emitter_1.emitter, this._options);

@@ -52,7 +35,4 @@ Emitter_1.emitter.emit(Contracts_1.IEvents.STARTED);

Emitter_1.emitter.emit(Contracts_1.IEvents.COMPLETED);
for (let hook of this._hooks.after) {
await hook(this, Emitter_1.emitter);
}
}
}
exports.Runner = Runner;

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

const Loader_1 = require("./Loader");
const Emitter_1 = require("../Emitter");
const loader = new Loader_1.Loader();

@@ -44,4 +45,5 @@ function testArgsFn(done, postRun) {

runner.reporter(reporterFn);
beforeHooks.forEach((hook) => runner.before(hook));
afterHooks.forEach((hook) => runner.after(hook));
for (let hook of beforeHooks) {
await hook(runner, Emitter_1.emitter);
}
const loaderFiles = await loader.loadFiles();

@@ -53,13 +55,15 @@ if (loaderFiles.length && groups.length) {

loaderFiles.forEach((file) => require(file));
let hardException = null;
try {
await runner.run();
if (exitProcess) {
runner.hasErrors ? process.exit(1) : process.exit(0);
}
}
catch (error) {
if (exitProcess) {
process.exit(1);
}
hardException = error;
}
for (let hook of afterHooks) {
await hook(runner, Emitter_1.emitter);
}
if (exitProcess) {
runner.hasErrors || hardException ? process.exit(1) : process.exit(0);
}
groups = [];

@@ -66,0 +70,0 @@ activeGroup = null;

@@ -0,1 +1,19 @@

## [2.0.10](https://github.com/thetutlage/japa/compare/v2.0.9...v2.0.10) (2019-04-19)
### Code Refactoring
* **slimrunner:** call hooks before loading test files ([e231d80](https://github.com/thetutlage/japa/commit/e231d80))
### BREAKING CHANGES
* **slimrunner:** The Runner class hooks support has been removed, since calling
hooks after loading the test files beats it's purpose.
Anyone using `Runner` class to build their own runtime has to add support for before
and after hooks like `slimRunner`
## [2.0.9](https://github.com/thetutlage/japa/compare/v2.0.8...v2.0.9) (2019-04-03)

@@ -2,0 +20,0 @@

{
"name": "japa",
"version": "2.0.9",
"version": "2.0.10",
"description": "Lean test runner for Node.js",

@@ -5,0 +5,0 @@ "main": "build/index.js",

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