Skip to content

Commit aa29f45

Browse files
committed
fix: care less about width of terminal
1 parent d48891a commit aa29f45

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

src/Reporter.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ const FailureMessage: React.FC<{
8181

8282
const CompletedTests: React.FC<{
8383
completedTests: State['completedTests'];
84-
width: number;
8584
globalConfig: Config.GlobalConfig;
86-
}> = ({ completedTests, width, globalConfig }) => {
85+
}> = ({ completedTests, globalConfig }) => {
8786
if (completedTests.length === 0) {
8887
return null;
8988
}
@@ -94,11 +93,7 @@ const CompletedTests: React.FC<{
9493
<Static>
9594
{completedTests.map(({ testResult, config }) => (
9695
<React.Fragment key={testResult.testFilePath + config.name}>
97-
<ResultHeader
98-
config={config}
99-
testResult={testResult}
100-
width={width}
101-
/>
96+
<ResultHeader config={config} testResult={testResult} />
10297
<TestConsoleOutput
10398
console={testResult.console}
10499
verbose={globalConfig.verbose}
@@ -249,7 +244,6 @@ const Reporter: React.FC<Props> = ({
249244
<Box flexDirection="column">
250245
<CompletedTests
251246
completedTests={completedTests}
252-
width={width}
253247
globalConfig={globalConfig}
254248
/>
255249
<RunningTests tests={currentTests} width={width} />

src/shared.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,32 +69,21 @@ const TestStatus: React.FC<{ testResult: TestResult }> = ({ testResult }) => {
6969
export const ResultHeader: React.FC<{
7070
testResult: TestResult;
7171
config: Config.ProjectConfig;
72-
width: number;
73-
}> = ({ testResult, config, width }) => (
72+
}> = ({ testResult, config }) => (
7473
<Box>
7574
<TestStatus testResult={testResult} />
7675
<DisplayName config={config} />
77-
<FormattedPath
78-
pad={8}
79-
columns={width}
80-
config={config}
81-
testPath={testResult.testFilePath}
82-
/>
76+
<FormatFullTestPath config={config} testPath={testResult.testFilePath} />
8377
</Box>
8478
);
8579

86-
export const FormattedPath = ({
87-
pad,
88-
config,
89-
testPath,
90-
columns,
91-
}: {
80+
export const FormattedPath: React.FC<{
9281
pad: number;
9382
config: Config.ProjectConfig | Config.GlobalConfig;
9483
testPath: Config.Path;
95-
columns: number;
96-
}) => {
97-
const maxLength = columns - pad;
84+
columns: number | undefined;
85+
}> = ({ pad, config, testPath, columns }) => {
86+
const maxLength = (columns || Number.NaN) - pad;
9887
const relative = relativePath(config, testPath);
9988
const { basename } = relative;
10089
let { dirname } = relative;

0 commit comments

Comments
 (0)