Skip to content

Commit 658f5d5

Browse files
committed
build: upgraded from Vitest v3 to v4
1 parent c564da1 commit 658f5d5

File tree

7 files changed

+126
-369
lines changed

7 files changed

+126
-369
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This is a log of major user-visible changes in each phpMyFAQ release.
4040
- migrated from WYSIWYG editor from TinyMCE to Jodit Editor (Thorsten)
4141
- migrated from JavaScript to TypeScript (Thorsten)
4242
- migrated from Webpack to Vite v7 (Thorsten)
43-
- migrated from Jest to Vitest v3 (Thorsten)
43+
- migrated from Jest to Vitest v4 (Thorsten)
4444

4545
### phpMyFAQ v4.0.14 - 2025-11-15
4646

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ We’ll provide periodic updates while triage and remediation are in progress.
4545
## Coordinated Disclosure
4646

4747
- Please do not publish or share details publicly until a fix is available and users have had a reasonable time to update.
48-
- We coordinate on a release date with you; our default disclosure window is up to 90 days from report, adjusted by severity and complexity.
48+
- We coordinate on a release date with you; our default disclosure window is up to 90 days from a report, adjusted by severity and complexity.
4949
- We will credit reporters in release notes and/or advisories unless you prefer to remain anonymous.
5050

5151
## Scope Guidance

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@thorsten/phpmyfaq",
3-
"version": "4.1.0-RC",
3+
"version": "4.1.0-beta.2",
44
"description": "phpMyFAQ",
55
"repository": "git://github.com/thorsten/phpMyFAQ.git",
66
"author": "Thorsten Rinne",
@@ -57,8 +57,8 @@
5757
"@types/masonry-layout": "^4.2.8",
5858
"@types/node": "^24.10.3",
5959
"@types/sortablejs": "^1.15.9",
60-
"@vitest/coverage-istanbul": "^3.2.4",
61-
"@vitest/coverage-v8": "^3.2.4",
60+
"@vitest/coverage-istanbul": "4.0.15",
61+
"@vitest/coverage-v8": "4.0.15",
6262
"autoprefixer": "^10.4.22",
6363
"husky": "^9.1.7",
6464
"jsdom": "^27.3.0",
@@ -73,7 +73,7 @@
7373
"vite-plugin-html": "^3.2.2",
7474
"vite-plugin-minify": "^2.1.0",
7575
"vite-plugin-static-copy": "^3.1.4",
76-
"vitest": "^3.2.4",
76+
"vitest": "^4.0.15",
7777
"vitest-fetch-mock": "^0.4.5"
7878
},
7979
"husky": {

phpmyfaq/admin/assets/src/configuration/instance.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import * as api from '../api/instance';
1919

2020
// Mock Bootstrap Modal globally
2121
vi.mock('bootstrap', () => ({
22-
Modal: vi.fn().mockImplementation((element: HTMLElement) => ({
23-
element,
24-
hide: vi.fn(),
25-
show: vi.fn(),
26-
})),
22+
Modal: vi.fn(function (this: any, element: HTMLElement) {
23+
this.element = element;
24+
this.hide = vi.fn();
25+
this.show = vi.fn();
26+
}),
2727
}));
2828

2929
describe('handleInstances - Initialization', () => {

phpmyfaq/admin/assets/src/utils/session.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { describe, it, expect, vi, afterEach } from 'vitest';
22
import { handleSessionTimeout } from './session';
33

44
vi.mock('bootstrap', () => ({
5-
Modal: vi.fn().mockImplementation(() => ({
6-
show: vi.fn(),
7-
hide: vi.fn(),
8-
})),
5+
Modal: class {
6+
show = vi.fn();
7+
hide = vi.fn();
8+
},
99
}));
1010

1111
describe('Session Utils', () => {
@@ -26,7 +26,9 @@ describe('Session Utils', () => {
2626
disconnect: vi.fn(),
2727
takeRecords: vi.fn(),
2828
};
29-
global.MutationObserver = vi.fn(() => mockObserver) as unknown as typeof MutationObserver;
29+
global.MutationObserver = function () {
30+
return mockObserver;
31+
} as unknown as typeof MutationObserver;
3032

3133
const mockReload = vi.fn();
3234
Object.defineProperty(global, 'location', {

phpmyfaq/assets/src/search/category.test.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,18 @@ import { TranslationService } from '../utils';
44
import { handleCategorySelection } from './category';
55

66
// Mock Choices.js
7-
vi.mock('choices.js', () => {
8-
return {
9-
default: vi.fn(),
10-
};
11-
});
7+
vi.mock('choices.js', () => ({
8+
default: vi.fn(),
9+
}));
1210

1311
// Mock TranslationService
14-
vi.mock('../utils', () => {
15-
const mockTranslationService = {
16-
translations: new Map(),
17-
loadTranslations: vi.fn().mockResolvedValue(undefined),
18-
translate: vi.fn().mockImplementation((key: string) => `translated_${key}`),
19-
};
20-
21-
return {
22-
TranslationService: vi.fn(() => mockTranslationService),
23-
};
24-
});
12+
vi.mock('../utils', () => ({
13+
TranslationService: vi.fn(function () {
14+
this.translations = new Map();
15+
this.loadTranslations = vi.fn().mockResolvedValue(undefined);
16+
this.translate = vi.fn().mockImplementation((key: string) => `translated_${key}`);
17+
}),
18+
}));
2519

2620
describe('handleCategorySelection', () => {
2721
const mockChoices = vi.mocked(Choices);
@@ -72,7 +66,11 @@ describe('handleCategorySelection', () => {
7266
loadTranslations: vi.fn().mockResolvedValue(undefined),
7367
translate: vi.fn().mockReturnValue('translated'),
7468
};
75-
mockTranslationService.mockReturnValue(mockInstance);
69+
mockTranslationService.mockImplementation(function () {
70+
this.translations = mockInstance.translations;
71+
this.loadTranslations = mockInstance.loadTranslations;
72+
this.translate = mockInstance.translate;
73+
});
7674

7775
await handleCategorySelection();
7876

0 commit comments

Comments
 (0)