Skip to content

Commit f127bc2

Browse files
committed
Fix tests CI
1 parent 44d1a0f commit f127bc2

File tree

6 files changed

+32
-16
lines changed

6 files changed

+32
-16
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Install modules
4646
run: npm install
4747
- name: Run tests
48-
run: npm run test -- -- -i --coverage || npm run test -- -- -i --coverage
48+
run: npm run test -- -- --coverage || npm run test -- -- --coverage
4949
- name: Upload coverage to Codecov
5050
uses: codecov/codecov-action@v1
5151
with:

package-lock.json

Lines changed: 22 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/tests/decorators/withBreakpointObserver.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { jest } from '@jest/globals';
2+
import retry from 'jest-retries';
23
import Base from '@studiometa/js-toolkit/abstracts/Base';
34
import withBreakpointObserver from '@studiometa/js-toolkit/decorators/withBreakpointObserver';
45
import resizeWindow from '../__utils__/resizeWindow';
@@ -59,7 +60,7 @@ describe('The withBreakpointObserver decorator', () => {
5960
expect(fooResponsive[0].__base__.$isMounted).toBe(true);
6061
});
6162

62-
it('should disable the decorated component', async () => {
63+
retry('should disable the decorated component', 5, async () => {
6364
await resizeWindow({ width: 480 });
6465
expect(window.innerWidth).toBe(480);
6566
expect(fooResponsive[0].__base__.$isMounted).toBe(true);

packages/tests/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"babel-jest": "^26.3.0",
1212
"htl": "^0.2.5",
1313
"html-loader-jest": "^0.2.1",
14-
"jest": "^26.4.2"
14+
"jest": "^26.4.2",
15+
"jest-retries": "^1.0.1"
1516
}
1617
}

packages/tests/services/scroll.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { jest } from '@jest/globals';
2+
import retry from 'jest-retries';
23
import useScroll from '@studiometa/js-toolkit/services/scroll';
34
import resizeWindow from '../__utils__/resizeWindow';
45
import wait from '../__utils__/wait';
@@ -39,7 +40,7 @@ describe('useScroll', () => {
3940
scrollHeightSpy.mockRestore();
4041
});
4142

42-
it('should trigger the callbacks on scroll', async () => {
43+
retry('should trigger the callbacks on scroll', 5, async () => {
4344
await resizeWindow({ width: 1000, height: 1000 });
4445
expect(fn).toHaveBeenCalledTimes(0);
4546

packages/tests/utils/nextFrame.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import { jest } from '@jest/globals';
2+
import retry from 'jest-retries';
23
import nextFrame from '@studiometa/js-toolkit/utils/nextFrame';
34
import wait from '../__utils__/wait';
45

56
describe('nextFrame method', () => {
6-
it('should execute the callback function in the next frame', async () => {
7+
retry('should execute the callback function in the next frame', 5, async () => {
78
const fn = jest.fn();
89
nextFrame(fn);
910
expect(fn).toHaveBeenCalledTimes(0);
1011
await wait(10);
1112
expect(fn).toHaveBeenCalledTimes(1);
1213
});
1314

14-
it('should work server-side', async () => {
15+
retry('should work server-side', 5, async () => {
1516
// Mock window === undefined
1617
// @see https://stackoverflow.com/a/56999581
1718
const windowSpy = jest.spyOn(globalThis, 'window', 'get');

0 commit comments

Comments
 (0)