Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ module.exports = {
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/prefer-ts-expect-error': 'error',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', caughtErrors: 'all' },
],
'no-else-return': 'error',
'no-negated-condition': 'error',
eqeqeq: ['error', 'smart'],
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@
"testEnvironment": "node"
},
"dependencies": {
"@jest/reporters": "^27.0.0",
"@jest/reporters": "^29.0.2",
"yoga-layout-prebuilt": "^1.10.0"
},
"devDependencies": {
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@jest/test-result": "^27.0.0",
"@jest/types": "^27.0.0",
"@jest/test-result": "^29.0.2",
"@jest/types": "^29.0.2",
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@types/jest": "^27.0.0",
"@types/jest": "^29.0.0",
"@types/node": "^16.0.0",
"@types/react": "^17.0.39",
"@typescript-eslint/eslint-plugin": "^5.0.0",
Expand All @@ -71,19 +71,19 @@
"eslint-plugin-react-hooks": "^4.0.2",
"husky": "^8.0.0",
"ink": "^3.2.0",
"jest": "^27.0.0",
"jest-util": "^27.0.0",
"jest": "^29.0.2",
"jest-util": "^29.0.2",
"lint-staged": "^13.0.0",
"patch-package": "^6.2.2",
"prettier": "^2.0.5",
"react": "^17.0.2",
"semantic-release": "^19.0.0",
"slash": "^3.0.0",
"ts-jest": "^27.0.0",
"ts-jest": "^29.0.0-next.1",
"typescript": "^4.0.0"
},
"peerDependencies": {
"jest": "^27.0.0"
"jest": "^27.0.0 || ^28.0.0 || ^29.0.0"
},
"engines": {
"node": ">=10"
Expand Down
4 changes: 2 additions & 2 deletions src/PostMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AggregatedResult } from '@jest/test-result';
import type { Config } from '@jest/types';
import type { Context } from '@jest/reporters';
import type { TestContext } from '@jest/reporters';
import { testPathPatternToRegExp } from 'jest-util';
import * as React from 'react';
import { Box, Text } from 'ink';
Expand Down Expand Up @@ -88,7 +88,7 @@ const ContextInfo: React.FC<{ numberOfContexts: number }> = ({
export const PostMessage: React.FC<{
aggregatedResults: AggregatedResult;
globalConfig: Config.GlobalConfig;
contexts: Set<Context>;
contexts: Set<TestContext>;
}> = ({ aggregatedResults, globalConfig, contexts }) => {
if (globalConfig.silent) {
return null;
Expand Down
19 changes: 11 additions & 8 deletions src/Reporter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import type { Config } from '@jest/types';
import type { AggregatedResult, TestResult } from '@jest/test-result';
import {
BaseReporter,
Context,
ReporterOnStartOptions,
Test,
TestContext,
} from '@jest/reporters';
import { SnapshotStatus } from './SnapshotStatus';
import { Summary } from './Summary';
Expand Down Expand Up @@ -99,7 +99,7 @@ const CompletedTests: React.FC<{
<Box paddingBottom={1} flexDirection="column">
<Static items={completedTests}>
{({ testResult, config }) => (
<React.Fragment key={testResult.testFilePath + config.name}>
<React.Fragment key={testResult.testFilePath + config.id}>
<ResultHeader config={config} testResult={testResult} />
<VerboseTestList
testResult={testResult}
Expand Down Expand Up @@ -132,7 +132,7 @@ type DateEvents =
testResult: TestResult;
};
}
| { type: 'TestComplete'; payload: { contexts: Set<Context> } };
| { type: 'TestComplete'; payload: { contexts: Set<TestContext> } };

type Props = {
register: (cb: (events: DateEvents) => void) => void;
Expand All @@ -147,9 +147,9 @@ type State = {
testResult: TestResult;
config: Config.ProjectConfig;
}>;
currentTests: Array<[Config.Path, Config.ProjectConfig]>;
currentTests: Array<[string, Config.ProjectConfig]>;
done: boolean;
contexts: Set<Context>;
contexts: Set<TestContext>;
};

const reporterReducer: React.Reducer<State, DateEvents> = (
Expand Down Expand Up @@ -199,7 +199,7 @@ const RunningTests: React.FC<{
return (
<Box paddingBottom={1} flexDirection="column">
{tests.map(([path, config]) => (
<Box key={path + config.name}>
<Box key={path + config.id}>
<Runs />
<DisplayName config={config} />
<FormattedPath
Expand All @@ -225,7 +225,7 @@ const Reporter: React.FC<Props> = ({
completedTests: [],
currentTests: [],
done: false,
contexts: new Set<Context>(),
contexts: new Set<TestContext>(),
});

React.useLayoutEffect(() => {
Expand Down Expand Up @@ -319,7 +319,10 @@ export default class ReactReporter extends BaseReporter {
);
}

async onRunComplete(contexts: Set<Context>) {
async onRunComplete(
contexts: Set<TestContext>,
_aggregatedResults?: AggregatedResult,
) {
this._components.forEach(cb =>
cb({ type: 'TestComplete', payload: { contexts } }),
);
Expand Down
4 changes: 2 additions & 2 deletions src/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const ResultHeader: React.FC<{
export const FormattedPath: React.FC<{
pad: number;
config: Config.ProjectConfig | Config.GlobalConfig;
testPath: Config.Path;
testPath: string;
columns: number | undefined;
}> = ({ pad, config, testPath, columns }) => {
const maxLength = (columns || Number.NaN) - pad;
Expand Down Expand Up @@ -135,7 +135,7 @@ export const FormattedPath: React.FC<{

export const FormatFullTestPath: React.FC<{
config: Config.GlobalConfig | Config.ProjectConfig;
testPath: Config.Path;
testPath: string;
}> = ({ config, testPath }) => (
// TODO: maybe not 9000? We just don't want to trim it
<FormattedPath config={config} testPath={testPath} pad={0} columns={9000} />
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Config } from '@jest/types';

export const relativePath = (
config: Config.GlobalConfig | Config.ProjectConfig,
testPath: Config.Path,
testPath: string,
) => {
// this function can be called with ProjectConfigs or GlobalConfigs. GlobalConfigs
// do not have config.cwd, only config.rootDir. Try using config.cwd, fallback
Expand Down
Loading