@japa/base-reporter
Advanced tools
Comparing version 1.1.2 to 2.0.0-0
@@ -1,2 +0,2 @@ | ||
export { BaseReporter } from './src/base_reporter'; | ||
export type { BaseReporterOptions } from './src/types'; | ||
export { BaseReporter } from './src/base_reporter.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,5 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BaseReporter = void 0; | ||
var base_reporter_1 = require("./src/base_reporter"); | ||
Object.defineProperty(exports, "BaseReporter", { enumerable: true, get: function () { return base_reporter_1.BaseReporter; } }); | ||
export { BaseReporter } from './src/base_reporter.js'; |
@@ -1,5 +0,5 @@ | ||
import type { BaseReporterOptions } from './types'; | ||
import type { BaseReporterOptions } from './types.js'; | ||
import type { Emitter, Runner, TestEndNode, SuiteEndNode, GroupEndNode, TestStartNode, RunnerEndNode, GroupStartNode, SuiteStartNode, RunnerStartNode } from '@japa/core'; | ||
export declare abstract class BaseReporter { | ||
private options; | ||
#private; | ||
runner: Runner<any>; | ||
@@ -13,3 +13,2 @@ currentFileName?: string; | ||
constructor(options?: Partial<BaseReporterOptions>); | ||
private printKeyValuePair; | ||
protected onTestStart(_: TestStartNode): void; | ||
@@ -23,6 +22,5 @@ protected onTestEnd(_: TestEndNode): void; | ||
protected end(_: RunnerEndNode): Promise<void>; | ||
private printAggregates; | ||
private printErrors; | ||
printSummary(summary: ReturnType<Runner<any>['getSummary']>): Promise<void>; | ||
boot(runner: Runner<any>, emitter: Emitter): void; | ||
} | ||
//# sourceMappingURL=base_reporter.d.ts.map |
@@ -1,12 +0,7 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BaseReporter = void 0; | ||
const ms_1 = __importDefault(require("ms")); | ||
const cliui_1 = require("@poppinss/cliui"); | ||
const errors_printer_1 = require("@japa/errors-printer"); | ||
class BaseReporter { | ||
options; | ||
import ms from 'ms'; | ||
import { cliui } from '@poppinss/cliui'; | ||
import { ErrorsPrinter } from '@japa/errors-printer'; | ||
export class BaseReporter { | ||
#options; | ||
#ui = cliui(); | ||
runner; | ||
@@ -17,8 +12,8 @@ currentFileName; | ||
constructor(options = {}) { | ||
this.options = { | ||
this.#options = { | ||
stackLinesCount: options.stackLinesCount || 5, | ||
}; | ||
} | ||
printKeyValuePair(key, value, whitespaceLength) { | ||
console.log(`${cliui_1.logger.colors.dim(`${key.padEnd(whitespaceLength + 2)} : `)}${value}`); | ||
#printKeyValuePair(key, value, whitespaceLength) { | ||
console.log(`${this.#ui.colors.dim(`${key.padEnd(whitespaceLength + 2)} : `)}${value}`); | ||
} | ||
@@ -33,28 +28,28 @@ onTestStart(_) { } | ||
async end(_) { } | ||
printAggregates(summary) { | ||
#printAggregates(summary) { | ||
const [tests, time] = [[], []]; | ||
time.push(cliui_1.logger.colors.dim((0, ms_1.default)(summary.duration))); | ||
time.push(this.#ui.colors.dim(ms(summary.duration))); | ||
if (summary.aggregates.passed) { | ||
tests.push(cliui_1.logger.colors.green(`${summary.aggregates.passed} passed`)); | ||
tests.push(this.#ui.colors.green(`${summary.aggregates.passed} passed`)); | ||
} | ||
if (summary.aggregates.failed) { | ||
tests.push(cliui_1.logger.colors.red(`${summary.aggregates.failed} failed`)); | ||
tests.push(this.#ui.colors.red(`${summary.aggregates.failed} failed`)); | ||
} | ||
if (summary.aggregates.todo) { | ||
tests.push(cliui_1.logger.colors.cyan(`${summary.aggregates.todo} todo`)); | ||
tests.push(this.#ui.colors.cyan(`${summary.aggregates.todo} todo`)); | ||
} | ||
if (summary.aggregates.skipped) { | ||
tests.push(cliui_1.logger.colors.yellow(`${summary.aggregates.skipped} skipped`)); | ||
tests.push(this.#ui.colors.yellow(`${summary.aggregates.skipped} skipped`)); | ||
} | ||
if (summary.aggregates.regression) { | ||
tests.push(cliui_1.logger.colors.magenta(`${summary.aggregates.regression} regression`)); | ||
tests.push(this.#ui.colors.magenta(`${summary.aggregates.regression} regression`)); | ||
} | ||
const keysPadding = summary.aggregates.uncaughtExceptions ? 19 : 5; | ||
this.printKeyValuePair('Tests', `${tests.join(', ')} ${cliui_1.logger.colors.dim(`(${summary.aggregates.total})`)}`, keysPadding); | ||
this.printKeyValuePair('Time', time.join(''), keysPadding); | ||
this.#printKeyValuePair('Tests', `${tests.join(', ')} ${this.#ui.colors.dim(`(${summary.aggregates.total})`)}`, keysPadding); | ||
this.#printKeyValuePair('Time', time.join(''), keysPadding); | ||
if (summary.aggregates.uncaughtExceptions) { | ||
this.printKeyValuePair('Uncaught exceptions', cliui_1.logger.colors.red(String(summary.aggregates.uncaughtExceptions)), keysPadding); | ||
this.#printKeyValuePair('Uncaught exceptions', this.#ui.colors.red(String(summary.aggregates.uncaughtExceptions)), keysPadding); | ||
} | ||
} | ||
async printErrors(summary) { | ||
async #printErrors(summary) { | ||
if (summary.failureTree.length || this.uncaughtExceptions.length) { | ||
@@ -64,4 +59,4 @@ console.log(''); | ||
} | ||
const errorPrinter = new errors_printer_1.ErrorsPrinter({ | ||
stackLinesCount: this.options.stackLinesCount, | ||
const errorPrinter = new ErrorsPrinter({ | ||
stackLinesCount: this.#options.stackLinesCount, | ||
}); | ||
@@ -87,14 +82,14 @@ for (let suite of summary.failureTree) { | ||
if (summary.aggregates.total === 0 && !summary.hasError) { | ||
console.log(cliui_1.logger.colors.bgYellow().black(' NO TESTS EXECUTED ')); | ||
console.log(this.#ui.colors.bgYellow().black(' NO TESTS EXECUTED ')); | ||
return; | ||
} | ||
if (summary.hasError) { | ||
console.log(cliui_1.logger.colors.bgRed().black(' FAILED ')); | ||
console.log(this.#ui.colors.bgRed().black(' FAILED ')); | ||
} | ||
else { | ||
console.log(cliui_1.logger.colors.bgGreen().black(' PASSED ')); | ||
console.log(this.#ui.colors.bgGreen().black(' PASSED ')); | ||
} | ||
console.log(''); | ||
this.printAggregates(summary); | ||
await this.printErrors(summary); | ||
this.#printAggregates(summary); | ||
await this.#printErrors(summary); | ||
} | ||
@@ -136,2 +131,1 @@ boot(runner, emitter) { | ||
} | ||
exports.BaseReporter = BaseReporter; |
export interface BaseReporterOptions { | ||
stackLinesCount?: number; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; |
139
package.json
{ | ||
"name": "@japa/base-reporter", | ||
"version": "1.1.2", | ||
"description": "Base reporter to create customized testing reporters for Japa", | ||
"type": "commonjs", | ||
"version": "2.0.0-0", | ||
"engines": { | ||
"node": ">=18.16.0" | ||
}, | ||
"main": "./build/index.js", | ||
"type": "module", | ||
"files": [ | ||
"index.ts", | ||
"src", | ||
"build/src", | ||
@@ -12,9 +17,9 @@ "build/index.js", | ||
], | ||
"types": "./build/index.d.ts", | ||
"exports": { | ||
".": "./build/index.js" | ||
".": "./build/index.js", | ||
"./types": "./build/src/types.js" | ||
}, | ||
"scripts": { | ||
"pretest": "npm run lint", | ||
"test": "node --require=@adonisjs/require-ts/build/register bin/test.ts", | ||
"pretest": "npm run lint && npm run typecheck", | ||
"test": "c8 npm run quick:test", | ||
"clean": "del-cli build", | ||
@@ -27,64 +32,59 @@ "compile": "npm run lint && npm run clean && tsc", | ||
"lint": "eslint . --ext=.ts", | ||
"typecheck": "tsc --noEmit", | ||
"format": "prettier --write .", | ||
"sync-labels": "github-label-sync --labels .github/labels.json @japa/base-reporter" | ||
"quick:test": "node --loader ts-node/esm bin/test.ts", | ||
"sync-labels": "github-label-sync --labels .github/labels.json japa/file-system" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"tag": "latest" | ||
}, | ||
"keywords": [], | ||
"author": "japa,virk", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@adonisjs/require-ts": "^2.0.13", | ||
"@commitlint/cli": "^17.4.4", | ||
"@commitlint/config-conventional": "^17.4.4", | ||
"@adonisjs/eslint-config": "^1.1.5", | ||
"@adonisjs/prettier-config": "^1.1.5", | ||
"@adonisjs/tsconfig": "^1.1.5", | ||
"@commitlint/cli": "^17.6.5", | ||
"@commitlint/config-conventional": "^17.6.5", | ||
"@japa/assert": "^1.4.1", | ||
"@japa/core": "^7.3.2", | ||
"@japa/core": "^7.3.3", | ||
"@japa/run-failed-tests": "^1.1.1", | ||
"@japa/runner": "^2.5.1", | ||
"@japa/spec-reporter": "^1.3.3", | ||
"@swc/core": "^1.3.66", | ||
"@types/ms": "^0.7.31", | ||
"@types/node": "^18.14.5", | ||
"@types/node": "^20.3.1", | ||
"c8": "^8.0.0", | ||
"del-cli": "^5.0.0", | ||
"eslint": "^8.35.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-plugin-adonis": "^3.0.3", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"github-label-sync": "^2.2.0", | ||
"eslint": "^8.43.0", | ||
"github-label-sync": "^2.3.1", | ||
"husky": "^8.0.3", | ||
"np": "^7.6.3", | ||
"prettier": "^2.8.4", | ||
"typescript": "^4.9.5" | ||
"np": "^8.0.4", | ||
"prettier": "^2.8.8", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.3" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"plugin:adonis/typescriptPackage", | ||
"prettier" | ||
], | ||
"plugins": [ | ||
"prettier" | ||
], | ||
"rules": { | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"endOfLine": "auto" | ||
} | ||
] | ||
} | ||
"dependencies": { | ||
"@japa/errors-printer": "^3.0.0-0", | ||
"@poppinss/cliui": "^6.1.1-2", | ||
"ms": "^2.1.3" | ||
}, | ||
"eslintIgnore": [ | ||
"build" | ||
"author": "japa,virk", | ||
"license": "MIT", | ||
"homepage": "https://github.com/japa/base-reporter#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/japa/base-reporter.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/japa/base-reporter/issues" | ||
}, | ||
"keywords": [ | ||
"japa", | ||
"test", | ||
"reporter" | ||
], | ||
"prettier": { | ||
"trailingComma": "es5", | ||
"semi": false, | ||
"singleQuote": true, | ||
"useTabs": false, | ||
"quoteProps": "consistent", | ||
"bracketSpacing": true, | ||
"arrowParens": "always", | ||
"printWidth": 100 | ||
"types": "./build/index.d.ts", | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"eslintConfig": { | ||
"extends": "@adonisjs/eslint-config/package" | ||
}, | ||
"prettier": "@adonisjs/prettier-config", | ||
"commitlint": { | ||
@@ -95,24 +95,21 @@ "extends": [ | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"tag": "next" | ||
}, | ||
"np": { | ||
"message": "chore(release): %s", | ||
"tag": "latest", | ||
"tag": "next", | ||
"branch": "main", | ||
"anyBranch": false | ||
}, | ||
"dependencies": { | ||
"@japa/errors-printer": "^2.1.0", | ||
"@poppinss/cliui": "^3.0.5", | ||
"ms": "^2.1.3" | ||
}, | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/japa/base-reporter.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/japa/base-reporter/issues" | ||
}, | ||
"homepage": "https://github.com/japa/base-reporter#readme" | ||
"c8": { | ||
"reporter": [ | ||
"text", | ||
"html" | ||
], | ||
"exclude": [ | ||
"tests/**" | ||
] | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
21657
14
375
Yes
22
1
1
+ Added@japa/errors-printer@3.0.4(transitive)
+ Added@poppinss/cliui@6.4.2(transitive)
+ Added@poppinss/colors@4.1.4(transitive)
+ Addedansi-escapes@7.0.0(transitive)
+ Addedansi-regex@6.1.0(transitive)
+ Addedansi-styles@6.2.1(transitive)
+ Addedcli-boxes@4.0.1(transitive)
+ Addedcli-cursor@5.0.0(transitive)
+ Addedcli-truncate@4.0.0(transitive)
+ Addedemoji-regex@10.4.0(transitive)
+ Addedenvironment@1.1.0(transitive)
+ Addedget-east-asian-width@1.3.0(transitive)
+ Addedis-fullwidth-code-point@4.0.05.0.0(transitive)
+ Addedlog-update@6.1.0(transitive)
+ Addedmimic-function@5.0.1(transitive)
+ Addedonetime@7.0.0(transitive)
+ Addedrestore-cursor@5.1.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedslice-ansi@5.0.07.1.0(transitive)
+ Addedstring-width@7.2.0(transitive)
+ Addedstrip-ansi@7.1.0(transitive)
+ Addedsupports-color@10.0.09.4.0(transitive)
+ Addedterminal-size@4.0.0(transitive)
+ Addedwrap-ansi@9.0.0(transitive)
- Removed@japa/errors-printer@2.1.0(transitive)
- Removed@poppinss/cliui@3.0.5(transitive)
- Removed@poppinss/colors@3.0.3(transitive)
- Removedansi-escapes@4.3.2(transitive)
- Removedastral-regex@2.0.0(transitive)
- Removedcli-boxes@3.0.0(transitive)
- Removedcli-cursor@3.1.0(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removedlog-update@4.0.0(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removedonetime@5.1.2(transitive)
- Removedrestore-cursor@3.1.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedslice-ansi@4.0.0(transitive)
- Removedtype-fest@0.21.3(transitive)
- Removedwrap-ansi@6.2.0(transitive)
Updated@poppinss/cliui@^6.1.1-2