diff --git a/src/dev/jest/junit_reporter.js b/src/dev/jest/junit_reporter.js index 082d9bc9a1b0..49bd0241a03f 100644 --- a/src/dev/jest/junit_reporter.js +++ b/src/dev/jest/junit_reporter.js @@ -72,8 +72,9 @@ export default class JestJUnitReporter { { skipNullAttributes: true } ); - const msToIso = (ms) => (ms ? new Date(ms).toISOString().slice(0, -5) : undefined); - const msToSec = (ms) => (ms ? (ms / 1000).toFixed(3) : undefined); + const isNumeric = (val) => !isNaN(parseFloat(val)) && isFinite(val); + const msToIso = (ms) => (isNumeric(ms) ? new Date(ms).toISOString().slice(0, -5) : undefined); + const msToSec = (ms) => (isNumeric(ms) ? (ms / 1000).toFixed(3) : undefined); root.att({ name: 'jest',