Skip to content

Commit a03ea71

Browse files
committed
main 🧊 update vitest
1 parent 45a7a3f commit a03ea71

File tree

46 files changed

+129
-166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+129
-166
lines changed
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
import { eslint } from "@siberiacancode/eslint";
1+
import { eslint } from '@siberiacancode/eslint';
22

33
export default eslint(
44
{
55
typescript: true,
66
javascript: true,
77
react: true,
88
jsx: true,
9-
vue: true,
9+
vue: true
1010
},
1111
{
12-
name: "siberiacancode/core/ignores",
13-
ignores: ["**/bundle/**/*.js"],
12+
name: 'siberiacancode/core/ignores',
13+
ignores: ['**/bundle/**/*.js']
1414
},
1515
{
16-
name: "siberiacancode/core/hooks",
17-
files: ["**/{hooks,helpers}/**/*.{ts,tsx}"],
16+
name: 'siberiacancode/core/hooks',
17+
files: ['**/{hooks,helpers}/**/*.{ts,tsx}'],
1818
rules: {
19-
"react-dom/no-flush-sync": "warn",
20-
"jsdoc/no-defaults": "off",
21-
"react-hooks/rules-of-hooks": "warn",
22-
"react/no-use-context": "off",
23-
"react/no-context-provider": "off",
24-
},
19+
'react-dom/no-flush-sync': 'warn',
20+
'jsdoc/no-defaults': 'off',
21+
'react-hooks/rules-of-hooks': 'warn',
22+
'react/no-use-context': 'off',
23+
'react/no-context-provider': 'off'
24+
}
2525
},
2626
{
27-
name: "siberiacancode/core/tests",
28-
files: ["**/*.test.ts"],
27+
name: 'siberiacancode/core/tests',
28+
files: ['**/*.test.ts'],
2929
rules: {
30-
"react/no-create-ref": "off",
31-
},
30+
'react/no-create-ref': 'off'
31+
}
3232
},
3333
{
34-
name: "siberiacancode/core/demo",
35-
files: ["**/*.demo.tsx"],
34+
name: 'siberiacancode/core/demo',
35+
files: ['**/*.demo.tsx'],
3636
rules: {
37-
"no-alert": "off",
38-
},
37+
'no-alert': 'off'
38+
}
3939
}
4040
);

β€Žpackages/core/package.jsonβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@
6464
"screenfull": "^6.0.2"
6565
},
6666
"devDependencies": {
67-
"@siberiacancode/vitest": "^2.3.0",
67+
"@siberiacancode/vitest": "^2.4.1",
6868
"@testing-library/dom": "^10.4.1",
6969
"@testing-library/react": "^16.3.2",
7070
"@types/dom-speech-recognition": "^0.0.7",
71-
"@types/react": "^19.2.13",
71+
"@types/react": "^19.2.14",
7272
"@types/react-dom": "^19.2.3",
7373
"@types/web-bluetooth": "^0.0.21",
74-
"@vitejs/plugin-react": "^5.1.3",
74+
"@vitejs/plugin-react": "^5.1.4",
7575
"core-js": "^3.48.0",
7676
"react": "^19.2.4",
7777
"react-dom": "^19.2.4",

β€Žpackages/core/src/bundle/hooks/useProgress/useProgress.jsβ€Ž

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const resolveAutoIncrement = (progress, trickleRate) => {
1010
};
1111
/**
1212
* @name useProgress
13-
* @description - Hook that creates a lightweight progress bar state with NProgress-like behavior
13+
* @description - Hook that creates a lightweight progress bar
1414
* @category Time
1515
* @usage medium
1616
*
@@ -19,7 +19,7 @@ const resolveAutoIncrement = (progress, trickleRate) => {
1919
* @param {number} [options.maximum=0.95] Maximum value when progress starts
2020
* @param {number} [options.speed=250] Auto increment interval in milliseconds
2121
* @param {number} [options.rate=0.02] Additional random increment amount on each tick
22-
* @param {number} [options.doneResetDelay=250] Delay before reset to null after done
22+
* @param {number} [options.delay=250] Delay before reset to null after done
2323
* @returns {UseProgressReturn} Current progress state and control methods
2424
*
2525
* @example
@@ -29,14 +29,15 @@ export const useProgress = (initialValue = 0, options = {}) => {
2929
const speed = Math.max(options.speed ?? 250, 16);
3030
const rate = clamp(options.rate ?? 0.02, 0, 0.3);
3131
const maximum = options.maximum ?? 0.98;
32+
const delay = options.delay ?? 250;
3233
const [value, setValue] = useState(initialValue);
3334
const [active, setActive] = useState(!!options.immediately);
3435
const [internalActive, setInternalActive] = useState(active);
3536
const intervalIdRef = useRef(undefined);
3637
const done = () => {
3738
setValue(1);
3839
setInternalActive(false);
39-
setTimeout(() => setActive(false), 250);
40+
setTimeout(() => setActive(false), delay);
4041
};
4142
const inc = (amount = resolveAutoIncrement(value, rate)) =>
4243
setValue((currentValue) => clamp(currentValue + amount, initialValue, maximum));

β€Žpackages/core/src/hooks/useActiveElement/useActiveElement.test.tsβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ class MockMutationObserver {
3232
globalThis.MutationObserver = MockMutationObserver as any;
3333

3434
beforeEach(trigger.clear);
35-
afterEach(vi.clearAllMocks);
36-
3735
const targets = [
3836
undefined,
3937
target('#target'),

β€Žpackages/core/src/hooks/useAsync/useAsync.test.tsβ€Ž

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ import { renderHookServer } from '@/tests';
44

55
import { useAsync } from './useAsync';
66

7-
afterEach(() => {
8-
vi.clearAllMocks();
9-
});
10-
117
it('Should use async', async () => {
128
const { result } = renderHook(() => useAsync(() => Promise.resolve('data')));
139

β€Žpackages/core/src/hooks/useAudio/useAudio.test.tsβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class MockAudio {
3030
currentTime = 0;
3131
}
3232

33-
afterEach(vi.clearAllMocks);
34-
3533
globalThis.Audio = MockAudio as unknown as typeof Audio;
3634

3735
it('Should use audio', () => {

β€Žpackages/core/src/hooks/useAutoScroll/useAutoScroll.test.tsβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ beforeEach(() => {
6060
trigger.clear();
6161
});
6262

63-
afterEach(vi.clearAllMocks);
64-
6563
targets.forEach((target) => {
6664
describe(`${target}`, () => {
6765
it('Should use auto scroll', () => {

β€Žpackages/core/src/hooks/useBreakpoints/useBreakpoints.test.tsβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ beforeEach(() => {
4040
});
4141
});
4242

43-
afterEach(vi.restoreAllMocks);
44-
4543
const breakpoints = {
4644
mobile: 0,
4745
tablet: 640,

β€Žpackages/core/src/hooks/useBroadcastChannel/useBroadcastChannel.test.tsβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ beforeEach(() => {
3333
});
3434
});
3535

36-
afterEach(vi.clearAllMocks);
37-
3836
it('Should use broadcast channel', () => {
3937
const { result } = renderHook(() => useBroadcastChannel(channelName));
4038

β€Žpackages/core/src/hooks/useClipboard/useClipboard.test.tsβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ beforeEach(() => {
2424
});
2525
});
2626

27-
afterEach(vi.clearAllMocks);
28-
2927
it('Should use copy to clipboard', () => {
3028
const { result } = renderHook(useClipboard);
3129

0 commit comments

Comments
Β (0)