Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Use default time 0.1s when test file time equal zero. This way we mee…
Browse files Browse the repository at this point in the history
…t Knapsack Pro API requirement to post only time execution greater than zero.

Related:
* KnapsackPro/knapsack_pro-ruby#71
* https://github.com/KnapsackPro/knapsack-pro-core-js/issues/3
  • Loading branch information
ArturT committed Jan 10, 2019
1 parent 623b4f9 commit 2f98261
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/knapsack-pro-jest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ const onSuccess: onQueueSuccessType = async (queueTestFiles: TestFile[]) => {
process.platform === 'win32'
? testFilePath.replace(`${projectPath}\\`, '').replace(/\\/g, '/')
: testFilePath.replace(`${projectPath}/`, '');
const timeExecutionMiliseconds = end - start;
// 0.1s default time when not recorded timing
const timeExecution =
timeExecutionMiliseconds > 0 ? timeExecutionMiliseconds / 1000 : 0.1;

return {
path,
time_execution: (end - start) / 1000,
time_execution: timeExecution,
};
},
);
Expand Down

0 comments on commit 2f98261

Please sign in to comment.