Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@vitejs/plugin-react": "^5.0.4",
"@vitest/browser": "^3.2.4",
"@vitest/coverage-istanbul": "^3.2.4",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"@vitest/browser": "^4.0.18",
"@vitest/browser-webdriverio": "^4.0.18",
"@vitest/coverage-istanbul": "^4.0.18",
"@vitest/coverage-v8": "^4.0.18",
"@vitest/ui": "^4.0.18",
"ckeditor5": "^46.0.0",
"ckeditor5-premium-features": "^46.0.0",
"eslint": "^9.38.0",
Expand Down Expand Up @@ -77,7 +78,7 @@
"typescript-eslint": "^8.46.2",
"upath": "^2.0.1",
"vite": "^7.1.9",
"vitest": "^3.2.4",
"vitest": "^4.0.18",
"webdriverio": "^9.12.7"
},
"engines": {
Expand Down Expand Up @@ -124,4 +125,4 @@
"eslint --quiet"
]
}
}
}
507 changes: 199 additions & 308 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion scripts-tests/vitest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import { defineConfig } from 'vitest/config';
export default defineConfig( {
test: {
testTimeout: 10000,
mockReset: true,
restoreMocks: true,
clearMocks: true,
mockReset: true,
unstubEnvs: true,
unstubGlobals: true,
include: [
'scripts-tests/**/*.@(js|mjs|cjs)'
],
Expand Down
5 changes: 0 additions & 5 deletions tests/ckeditor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ describe( '<CKEditor> Component', () => {
} );

afterEach( () => {
vi.restoreAllMocks();
vi.clearAllTimers();
vi.unstubAllEnvs();
vi.unstubAllGlobals();

component?.unmount();
manager.clear();

Expand Down
10 changes: 0 additions & 10 deletions tests/context/ckeditorcontext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ describe( '<CKEditorContext> Component', () => {
let component: RenderResult | null = null;

afterEach( () => {
vi.restoreAllMocks();
vi.clearAllTimers();
vi.unstubAllEnvs();
vi.unstubAllGlobals();

component?.unmount();
manager.clear();
} );
Expand Down Expand Up @@ -889,11 +884,6 @@ describe( 'EditorWatchdogAdapter', () => {
let component: RenderResult | null = null;

afterEach( () => {
vi.restoreAllMocks();
vi.clearAllTimers();
vi.unstubAllEnvs();
vi.unstubAllGlobals();

component?.unmount();
manager.clear();
} );
Expand Down
6 changes: 1 addition & 5 deletions tests/context/useInitializedCKEditorsMap.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/

import { describe, it, expect, vi, afterEach } from 'vitest';
import { describe, it, expect, vi } from 'vitest';
import { renderHook } from '@testing-library/react';
import { Collection } from 'ckeditor5';

Expand All @@ -15,10 +15,6 @@ import type { CKEditorConfigContextMetadata } from '../../src/context/setCKEdito
import MockEditor from '../_utils/editor.js';

describe( 'useInitializedCKEditorsMap', () => {
afterEach( () => {
vi.clearAllMocks();
} );

it( 'should not call onChangeInitializedEditors when context is not initialized', () => {
const onChangeInitializedEditors = vi.fn();
const mockWatchdog = {
Expand Down
7 changes: 1 addition & 6 deletions tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/

import { describe, afterEach, it, expect, vi } from 'vitest';
import { describe, afterEach, it, expect } from 'vitest';
import React from 'react';
import { ContextWatchdog } from 'ckeditor5';
import { render, type RenderResult } from '@testing-library/react';
Expand All @@ -19,11 +19,6 @@ describe( 'index.js', () => {
let component: RenderResult | null = null;

afterEach( () => {
vi.restoreAllMocks();
vi.clearAllTimers();
vi.unstubAllEnvs();
vi.unstubAllGlobals();

component?.unmount();
manager.clear();
} );
Expand Down
2 changes: 0 additions & 2 deletions tests/lifecycle/LifeCycleElementSemaphore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ describe( 'LifeCycleElementSemaphore', () => {

afterEach( () => {
semaphore.release();
vi.restoreAllMocks();
vi.clearAllTimers();
} );

it( 'should initialize with correct values', () => {
Expand Down
7 changes: 1 addition & 6 deletions tests/lifecycle/useLifeCycleSemaphoreSyncRef.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/

import { it, describe, expect, vi, beforeEach, afterEach } from 'vitest';
import { it, describe, expect, vi, beforeEach } from 'vitest';
import { renderHook, act } from '@testing-library/react';

import { LifeCycleElementSemaphore } from '../../src/lifecycle/LifeCycleElementSemaphore.js';
Expand All @@ -19,11 +19,6 @@ describe( 'useLifeCycleSemaphoreSyncRef', () => {
} );
} );

afterEach( () => {
vi.restoreAllMocks();
vi.clearAllTimers();
} );

it( 'should initialize with null semaphore', () => {
const { result } = renderHook( () => useLifeCycleSemaphoreSyncRef() );

Expand Down
5 changes: 0 additions & 5 deletions tests/useMultiRootEditor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ describe( 'useMultiRootEditor', () => {
} );

afterEach( () => {
vi.restoreAllMocks();
vi.clearAllTimers();
vi.unstubAllEnvs();
vi.unstubAllGlobals();

editorProps.semaphoreElement = null;
} );

Expand Down
8 changes: 7 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { resolve } from 'node:path';
import { defineConfig } from 'vitest/config';
import { webdriverio } from '@vitest/browser-webdriverio';
import react from '@vitejs/plugin-react';
import pkg from './package.json' with { type: 'json' };

Expand Down Expand Up @@ -46,6 +47,11 @@ export default defineConfig( {

// https://vitest.dev/config/
test: {
restoreMocks: true,
clearMocks: true,
mockReset: true,
unstubEnvs: true,
unstubGlobals: true,
setupFiles: [ './vitest-setup.ts' ],
include: [
'tests/**/*.test.[j|t]sx'
Expand All @@ -71,7 +77,7 @@ export default defineConfig( {
browser: {
enabled: true,
headless: true,
provider: 'webdriverio',
provider: webdriverio(),
screenshotFailures: false,
instances: [
{ browser: 'chrome' }
Expand Down