Skip to content

Commit

Permalink
test: increase percentage diff on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS committed Oct 15, 2024
1 parent ddf6dc7 commit fa57188
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
matrix:
node-version: [18, 20, 22]

env:
CI: true

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
17 changes: 13 additions & 4 deletions test/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ describe('Same benchmark function', () => {
const percentageDifference = (difference / Math.min(opsSec1, opsSec2)) * 100;

// Check if the percentage difference is less than or equal to 10%
assert.ok(
percentageDifference <= 10,
`${opsSec1} too different from ${opsSec2} - ${results[i].name}`
);
if (process.env.CI) {
// CI runs in a shared-env so the percentage of difference
// must be greather there due to high variance of hardware
assert.ok(
percentageDifference <= 30,
`${opsSec1} too different from ${opsSec2} - ${results[i].name}`
);
} else {
assert.ok(
percentageDifference <= 10,
`${opsSec1} too different from ${opsSec2} - ${results[i].name}`
);
}
}
}
}
Expand Down

0 comments on commit fa57188

Please sign in to comment.