diff --git a/src/dev/jest/junit_reporter.js b/src/dev/jest/junit_reporter.js index 35b8a5a39608..65f244042a12 100644 --- a/src/dev/jest/junit_reporter.js +++ b/src/dev/jest/junit_reporter.js @@ -70,8 +70,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',