Skip to content

Commit fab6bcc

Browse files
committed
Merge branch 'dev' of https://github.com/Hargne/jest-html-reporter into dev
2 parents 8f5a328 + e24504b commit fab6bcc

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ or via adding a key to `package.json` named "jest-html-reporter":
9292
| **`customScriptPath`** | `string` | `null` | Path to an external script file injected into the report. |
9393
| **`dateFormat`** | `string` | `yyyy-mm-dd HH:MM:ss` | Date format for timestamps. See [documentation](https://github.com/Hargne/jest-html-reporter/wiki/Date-Format) for available formats. |
9494
| **`executionTimeWarningThreshold`** | `number` | `5` | Warn if a test suite exceeds this execution time (in seconds). |
95-
| **`hideConsoleLogOrigin`** | `boolean` | `true` | Hide `console.log` origin (stack trace) in the report (**requires** `--verbose=false`). |
95+
| **`hideConsoleLogOrigin`** | `boolean` | `false` | Hide `console.log` origin (stack trace) in the report (**requires** `--verbose=false`). |
9696
| **`includeConsoleLog`** | `boolean` | `false` | Include `console.log` outputs in the report (**requires** `--verbose=false`). |
9797
| **`includeFailureMsg`** | `boolean` | `false` | Show detailed error messages for failed tests. |
9898
| **`includeStackTrace`** | `boolean` | `true` | Show stack traces for failed tests. |

src/extractConfiguration.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
parseBoolean,
88
parseNumber,
99
parseString,
10+
logMessage,
1011
} from "./utils";
1112

1213
const defaultValues: JestHTMLReporterConfiguration = {
@@ -90,6 +91,17 @@ export function sanitizeConfig(
9091
return {};
9192
}
9293

94+
// Alert regarding unknown configuration keys
95+
const unknownKeys = Object.keys(input).filter(
96+
(key) => !(key in defaultValues)
97+
);
98+
for (const key of unknownKeys) {
99+
logMessage(
100+
"error",
101+
`Unknown configuration key "${key}" found. This key will be ignored.`
102+
);
103+
}
104+
93105
return (
94106
Object.keys(defaultValues) as (keyof JestHTMLReporterConfiguration)[]
95107
).reduce((sanitized, key) => {
@@ -123,7 +135,7 @@ export default function (cliConfig: unknown): JestHTMLReporterConfiguration {
123135
const packageJsonConfig =
124136
readJsonFile(path.join(process.cwd(), "package.json"))[
125137
"jest-html-reporter"
126-
] || {};
138+
] ?? {};
127139

128140
// Merge configurations in priority order (with sanitization)
129141
return {

0 commit comments

Comments
 (0)