@jest/reporters
Advanced tools
Comparing version 28.0.0-alpha.8 to 28.0.0-alpha.9
@@ -43,3 +43,3 @@ 'use strict'; | ||
onRunComplete(_contexts, _aggregatedResults) {} | ||
onRunComplete(_testContexts, _aggregatedResults) {} | ||
@@ -46,0 +46,0 @@ _setError(error) { |
@@ -189,11 +189,12 @@ 'use strict'; | ||
class CoverageReporter extends _BaseReporter.default { | ||
_context; | ||
_coverageMap; | ||
_globalConfig; | ||
_sourceMapStore; | ||
_options; | ||
_v8CoverageResults; | ||
static filename = __filename; | ||
constructor(globalConfig, options) { | ||
constructor(globalConfig, context) { | ||
super(); | ||
this._context = context; | ||
this._coverageMap = _istanbulLibCoverage().default.createCoverageMap({}); | ||
@@ -204,3 +205,2 @@ this._globalConfig = globalConfig; | ||
this._v8CoverageResults = []; | ||
this._options = options || {}; | ||
} | ||
@@ -220,4 +220,4 @@ | ||
async onRunComplete(contexts, aggregatedResults) { | ||
await this._addUntestedFiles(contexts); | ||
async onRunComplete(testContexts, aggregatedResults) { | ||
await this._addUntestedFiles(testContexts); | ||
const {map, reportContext} = await this._getCoverageResult(); | ||
@@ -260,5 +260,5 @@ | ||
async _addUntestedFiles(contexts) { | ||
async _addUntestedFiles(testContexts) { | ||
const files = []; | ||
contexts.forEach(context => { | ||
testContexts.forEach(context => { | ||
const config = context.config; | ||
@@ -322,12 +322,11 @@ | ||
config, | ||
globalConfig: this._globalConfig, | ||
options: { | ||
...this._options, | ||
context: { | ||
changedFiles: | ||
this._options.changedFiles && | ||
Array.from(this._options.changedFiles), | ||
this._context.changedFiles && | ||
Array.from(this._context.changedFiles), | ||
sourcesRelatedToTestsInChangedFiles: | ||
this._options.sourcesRelatedToTestsInChangedFiles && | ||
Array.from(this._options.sourcesRelatedToTestsInChangedFiles) | ||
this._context.sourcesRelatedToTestsInChangedFiles && | ||
Array.from(this._context.sourcesRelatedToTestsInChangedFiles) | ||
}, | ||
globalConfig: this._globalConfig, | ||
path: filename | ||
@@ -334,0 +333,0 @@ }); |
@@ -90,3 +90,3 @@ 'use strict'; | ||
function worker({config, globalConfig, path, options}) { | ||
function worker({config, globalConfig, path, context}) { | ||
return (0, _generateEmptyCoverage.default)( | ||
@@ -97,9 +97,6 @@ fs().readFileSync(path, 'utf8'), | ||
config, | ||
(options === null || options === void 0 ? void 0 : options.changedFiles) && | ||
new Set(options.changedFiles), | ||
(options === null || options === void 0 | ||
? void 0 | ||
: options.sourcesRelatedToTestsInChangedFiles) && | ||
new Set(options.sourcesRelatedToTestsInChangedFiles) | ||
context.changedFiles && new Set(context.changedFiles), | ||
context.sourcesRelatedToTestsInChangedFiles && | ||
new Set(context.sourcesRelatedToTestsInChangedFiles) | ||
); | ||
} |
@@ -43,3 +43,5 @@ 'use strict'; | ||
class GitHubActionsReporter extends _BaseReporter.default { | ||
onRunComplete(_contexts, aggregatedResults) { | ||
static filename = __filename; | ||
onRunComplete(_testContexts, aggregatedResults) { | ||
const messages = getMessages( | ||
@@ -71,5 +73,5 @@ aggregatedResults === null || aggregatedResults === void 0 | ||
([message, line, col]) => | ||
`::error file=${testFilePath},line=${line},col=${col}::${message}` | ||
`\n::error file=${testFilePath},line=${line},col=${col}::${message}` | ||
) | ||
); | ||
} |
@@ -12,10 +12,9 @@ /** | ||
import {Config} from '@jest/types'; | ||
import type {FS} from 'jest-haste-map'; | ||
import {GlobalConfig} from '@jest/types/build/Config'; | ||
import type {ModuleMap} from 'jest-haste-map'; | ||
import {ProjectConfig} from '@jest/types/build/Config'; | ||
import type Resolver from 'jest-resolve'; | ||
import {SnapshotSummary} from '@jest/test-result'; | ||
import type {Suite} from '@jest/test-result'; | ||
import type {TestCaseResult} from '@jest/test-result'; | ||
import {Test} from '@jest/test-result'; | ||
import {TestCaseResult} from '@jest/test-result'; | ||
import {TestContext} from '@jest/test-result'; | ||
import {TestResult} from '@jest/test-result'; | ||
@@ -40,3 +39,3 @@ | ||
onRunComplete( | ||
_contexts?: Set<Context>, | ||
_testContexts?: Set<TestContext>, | ||
_aggregatedResults?: AggregatedResult, | ||
@@ -50,23 +49,13 @@ ): Promise<void> | void; | ||
export declare type Context = { | ||
config: Config.ProjectConfig; | ||
hasteFS: FS; | ||
moduleMap: ModuleMap; | ||
resolver: Resolver; | ||
}; | ||
export declare class CoverageReporter extends BaseReporter { | ||
private _context; | ||
private _coverageMap; | ||
private _globalConfig; | ||
private _sourceMapStore; | ||
private _options; | ||
private _v8CoverageResults; | ||
static readonly filename: string; | ||
constructor( | ||
globalConfig: Config.GlobalConfig, | ||
options?: CoverageReporterOptions, | ||
); | ||
constructor(globalConfig: Config.GlobalConfig, context: ReporterContext); | ||
onTestResult(_test: Test, testResult: TestResult): void; | ||
onRunComplete( | ||
contexts: Set<Context>, | ||
testContexts: Set<TestContext>, | ||
aggregatedResults: AggregatedResult, | ||
@@ -79,7 +68,2 @@ ): Promise<void>; | ||
declare type CoverageReporterOptions = { | ||
changedFiles?: Set<string>; | ||
sourcesRelatedToTestsInChangedFiles?: Set<string>; | ||
}; | ||
export declare class DefaultReporter extends BaseReporter { | ||
@@ -135,5 +119,17 @@ private _clear; | ||
declare function getSnapshotStatus( | ||
snapshot: TestResult['snapshot'], | ||
afterUpdate: boolean, | ||
): Array<string>; | ||
declare function getSnapshotSummary( | ||
snapshots: SnapshotSummary, | ||
globalConfig: Config.GlobalConfig, | ||
updateCommand: string, | ||
): Array<string>; | ||
export declare class GitHubActionsReporter extends BaseReporter { | ||
static readonly filename: string; | ||
onRunComplete( | ||
_contexts?: Set<Context>, | ||
_testContexts?: Set<TestContext>, | ||
aggregatedResults?: AggregatedResult, | ||
@@ -145,12 +141,7 @@ ): void; | ||
private _notifier; | ||
private _startRun; | ||
private _globalConfig; | ||
private _context; | ||
static readonly filename: string; | ||
constructor( | ||
globalConfig: Config.GlobalConfig, | ||
startRun: (globalConfig: Config.GlobalConfig) => unknown, | ||
context: TestSchedulerContext, | ||
); | ||
onRunComplete(contexts: Set<Context>, result: AggregatedResult): void; | ||
constructor(globalConfig: Config.GlobalConfig, context: ReporterContext); | ||
onRunComplete(testContexts: Set<TestContext>, result: AggregatedResult): void; | ||
} | ||
@@ -180,3 +171,3 @@ | ||
readonly onRunComplete: ( | ||
contexts: Set<Context>, | ||
testContexts: Set<TestContext>, | ||
results: AggregatedResult, | ||
@@ -187,2 +178,10 @@ ) => Promise<void> | void; | ||
export declare type ReporterContext = { | ||
firstRun: boolean; | ||
previousSuccess: boolean; | ||
changedFiles?: Set<string>; | ||
sourcesRelatedToTestsInChangedFiles?: Set<string>; | ||
startRun?: (globalConfig: Config.GlobalConfig) => unknown; | ||
}; | ||
export declare type ReporterOnStartOptions = { | ||
@@ -216,3 +215,3 @@ estimatedTime: number; | ||
onRunComplete( | ||
contexts: Set<Context>, | ||
testContexts: Set<TestContext>, | ||
aggregatedResults: AggregatedResult, | ||
@@ -225,16 +224,10 @@ ): void; | ||
export declare type Test = { | ||
context: Context; | ||
duration?: number; | ||
path: string; | ||
}; | ||
export {Test}; | ||
export {TestCaseResult}; | ||
export {TestContext}; | ||
export {TestResult}; | ||
declare type TestSchedulerContext = { | ||
firstRun: boolean; | ||
previousSuccess: boolean; | ||
changedFiles?: Set<string>; | ||
}; | ||
export declare const utils: { | ||
@@ -246,2 +239,4 @@ formatTestPath: ( | ||
getResultHeader: typeof getResultHeader; | ||
getSnapshotStatus: typeof getSnapshotStatus; | ||
getSnapshotSummary: typeof getSnapshotSummary; | ||
getSummary: ( | ||
@@ -248,0 +243,0 @@ aggregatedResults: AggregatedResult, |
@@ -52,2 +52,8 @@ 'use strict'; | ||
var _getSnapshotStatus = _interopRequireDefault(require('./getSnapshotStatus')); | ||
var _getSnapshotSummary = _interopRequireDefault( | ||
require('./getSnapshotSummary') | ||
); | ||
var _utils = require('./utils'); | ||
@@ -84,2 +90,4 @@ | ||
getResultHeader: _getResultHeader.default, | ||
getSnapshotStatus: _getSnapshotStatus.default, | ||
getSnapshotSummary: _getSnapshotSummary.default, | ||
getSummary: _utils.getSummary, | ||
@@ -86,0 +94,0 @@ printDisplayName: _utils.printDisplayName, |
@@ -107,3 +107,2 @@ 'use strict'; | ||
_notifier = loadNotifier(); | ||
_startRun; | ||
_globalConfig; | ||
@@ -113,13 +112,12 @@ _context; | ||
constructor(globalConfig, startRun, context) { | ||
constructor(globalConfig, context) { | ||
super(); | ||
this._globalConfig = globalConfig; | ||
this._startRun = startRun; | ||
this._context = context; | ||
} | ||
onRunComplete(contexts, result) { | ||
onRunComplete(testContexts, result) { | ||
const success = | ||
result.numFailedTests === 0 && result.numRuntimeErrorTestSuites === 0; | ||
const firstContext = contexts.values().next(); | ||
const firstContext = testContexts.values().next(); | ||
const hasteFS = | ||
@@ -222,4 +220,7 @@ firstContext && firstContext.value && firstContext.value.hasteFS; | ||
if (metadata.activationValue === restartAnswer) { | ||
this._startRun(this._globalConfig); | ||
if ( | ||
metadata.activationValue === restartAnswer && | ||
this._context.startRun | ||
) { | ||
this._context.startRun(this._globalConfig); | ||
} | ||
@@ -226,0 +227,0 @@ } |
@@ -104,3 +104,3 @@ 'use strict'; | ||
onRunComplete(contexts, aggregatedResults) { | ||
onRunComplete(testContexts, aggregatedResults) { | ||
const {numTotalTestSuites, testResults, wasInterrupted} = aggregatedResults; | ||
@@ -137,3 +137,3 @@ | ||
? _chalk().default.bold.red('Test run was interrupted.') | ||
: this._getTestSummary(contexts, this._globalConfig) | ||
: this._getTestSummary(testContexts, this._globalConfig) | ||
}`; | ||
@@ -213,3 +213,3 @@ } | ||
_getTestSummary(contexts, globalConfig) { | ||
_getTestSummary(testContexts, globalConfig) { | ||
const getMatchingTestsInfo = () => { | ||
@@ -248,5 +248,5 @@ const prefix = globalConfig.findRelatedTests | ||
const contextInfo = | ||
contexts.size > 1 | ||
testContexts.size > 1 | ||
? _chalk().default.dim(' in ') + | ||
contexts.size + | ||
testContexts.size + | ||
_chalk().default.dim(' projects') | ||
@@ -253,0 +253,0 @@ : ''; |
{ | ||
"name": "@jest/reporters", | ||
"description": "Jest's reporters", | ||
"version": "28.0.0-alpha.8", | ||
"version": "28.0.0-alpha.9", | ||
"main": "./build/index.js", | ||
@@ -16,6 +16,6 @@ "types": "./build/index.d.ts", | ||
"@bcoe/v8-coverage": "^0.2.3", | ||
"@jest/console": "^28.0.0-alpha.8", | ||
"@jest/test-result": "^28.0.0-alpha.8", | ||
"@jest/transform": "^28.0.0-alpha.8", | ||
"@jest/types": "^28.0.0-alpha.8", | ||
"@jest/console": "^28.0.0-alpha.9", | ||
"@jest/test-result": "^28.0.0-alpha.9", | ||
"@jest/transform": "^28.0.0-alpha.9", | ||
"@jest/types": "^28.0.0-alpha.9", | ||
"@types/node": "*", | ||
@@ -25,3 +25,3 @@ "chalk": "^4.0.0", | ||
"exit": "^0.1.2", | ||
"glob": "^7.1.2", | ||
"glob": "^7.1.3", | ||
"graceful-fs": "^4.2.9", | ||
@@ -33,8 +33,6 @@ "istanbul-lib-coverage": "^3.0.0", | ||
"istanbul-reports": "^3.1.3", | ||
"jest-haste-map": "^28.0.0-alpha.8", | ||
"jest-resolve": "^28.0.0-alpha.8", | ||
"jest-util": "^28.0.0-alpha.8", | ||
"jest-worker": "^28.0.0-alpha.8", | ||
"jest-util": "^28.0.0-alpha.9", | ||
"jest-worker": "^28.0.0-alpha.9", | ||
"slash": "^3.0.0", | ||
"source-map": "^0.6.0", | ||
"source-map": "^0.6.1", | ||
"string-length": "^4.0.1", | ||
@@ -45,3 +43,3 @@ "terminal-link": "^2.0.0", | ||
"devDependencies": { | ||
"@jest/test-utils": "^28.0.0-alpha.8", | ||
"@jest/test-utils": "^28.0.0-alpha.9", | ||
"@types/exit": "^0.1.30", | ||
@@ -56,2 +54,3 @@ "@types/glob": "^7.1.1", | ||
"@types/node-notifier": "^8.0.0", | ||
"jest-resolve": "^28.0.0-alpha.9", | ||
"mock-fs": "^5.1.2", | ||
@@ -73,3 +72,3 @@ "strip-ansi": "^6.0.0" | ||
"type": "git", | ||
"url": "https://github.com/facebook/jest", | ||
"url": "https://github.com/facebook/jest.git", | ||
"directory": "packages/jest-reporters" | ||
@@ -85,3 +84,3 @@ }, | ||
}, | ||
"gitHead": "d915e7df92b220dbe6e124585ba6459838a6c41c" | ||
"gitHead": "7c63f5981eb20d4b89a4c04f3675e0050d8d7887" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97789
24
13
2960
- Removedjest-haste-map@^28.0.0-alpha.8
- Removedjest-resolve@^28.0.0-alpha.8
- Removedcamelcase@6.3.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedjest-get-type@28.0.2(transitive)
- Removedjest-pnp-resolver@1.2.3(transitive)
- Removedjest-resolve@28.1.3(transitive)
- Removedjest-validate@28.1.3(transitive)
- Removedleven@3.1.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedresolve@1.22.8(transitive)
- Removedresolve.exports@1.1.1(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
Updated@jest/types@^28.0.0-alpha.9
Updatedglob@^7.1.3
Updatedjest-util@^28.0.0-alpha.9
Updatedjest-worker@^28.0.0-alpha.9
Updatedsource-map@^0.6.1