diff --git a/src/Autocomplete/assets/test/controller.test.ts b/src/Autocomplete/assets/test/controller.test.ts
index e6a6d6d3cd7..9c02e4b0113 100644
--- a/src/Autocomplete/assets/test/controller.test.ts
+++ b/src/Autocomplete/assets/test/controller.test.ts
@@ -11,7 +11,7 @@ import { Application } from '@hotwired/stimulus';
import { getByTestId, waitFor } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';
import type TomSelect from 'tom-select';
-import { vi } from 'vitest';
+import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import createFetchMock from 'vitest-fetch-mock';
import AutocompleteController, {
type AutocompleteConnectOptions,
diff --git a/src/Chartjs/assets/test/controller.test.ts b/src/Chartjs/assets/test/controller.test.ts
index 4378bf4d2af..b31821b5eb9 100644
--- a/src/Chartjs/assets/test/controller.test.ts
+++ b/src/Chartjs/assets/test/controller.test.ts
@@ -9,6 +9,7 @@
import { Application } from '@hotwired/stimulus';
import { waitFor } from '@testing-library/dom';
+import { afterEach, beforeAll, describe, expect, it } from 'vitest';
import ChartjsController from '../src/controller';
// Kept track of globally, but just used in one test.
diff --git a/src/Cropperjs/assets/test/controller.test.ts b/src/Cropperjs/assets/test/controller.test.ts
index 02e45acc868..42f20bd9015 100644
--- a/src/Cropperjs/assets/test/controller.test.ts
+++ b/src/Cropperjs/assets/test/controller.test.ts
@@ -9,6 +9,7 @@
import { Application, Controller } from '@hotwired/stimulus';
import { getByTestId, waitFor } from '@testing-library/dom';
+import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { clearDOM, mountDOM } from '../../../../test/stimulus-helpers';
import CropperjsController from '../src/controller';
diff --git a/src/Dropzone/assets/test/controller.test.ts b/src/Dropzone/assets/test/controller.test.ts
index 571868c67e9..b13f33840d5 100644
--- a/src/Dropzone/assets/test/controller.test.ts
+++ b/src/Dropzone/assets/test/controller.test.ts
@@ -10,6 +10,7 @@
import { Application, Controller } from '@hotwired/stimulus';
import { getByTestId, waitFor } from '@testing-library/dom';
import user from '@testing-library/user-event';
+import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { clearDOM, mountDOM } from '../../../../test/stimulus-helpers';
import DropzoneController from '../src/controller';
diff --git a/src/LazyImage/assets/test/controller.test.ts b/src/LazyImage/assets/test/controller.test.ts
index 2dd5cc4cbf8..fa6737e756e 100644
--- a/src/LazyImage/assets/test/controller.test.ts
+++ b/src/LazyImage/assets/test/controller.test.ts
@@ -9,6 +9,7 @@
import { Application, Controller } from '@hotwired/stimulus';
import { getByTestId, waitFor } from '@testing-library/dom';
+import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { clearDOM, mountDOM } from '../../../../test/stimulus-helpers';
import LazyImageController from '../src/controller';
diff --git a/src/LiveComponent/assets/test/Backend/RequestBuilder.test.ts b/src/LiveComponent/assets/test/Backend/RequestBuilder.test.ts
index 44521271e80..1b55fd27f4f 100644
--- a/src/LiveComponent/assets/test/Backend/RequestBuilder.test.ts
+++ b/src/LiveComponent/assets/test/Backend/RequestBuilder.test.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it } from 'vitest';
import RequestBuilder from '../../src/Backend/RequestBuilder';
describe('buildRequest', () => {
diff --git a/src/LiveComponent/assets/test/Component/index.test.ts b/src/LiveComponent/assets/test/Component/index.test.ts
index 79ef365581c..865723b3faa 100644
--- a/src/LiveComponent/assets/test/Component/index.test.ts
+++ b/src/LiveComponent/assets/test/Component/index.test.ts
@@ -1,5 +1,6 @@
import { waitFor } from '@testing-library/dom';
import { Response } from 'node-fetch';
+import { describe, expect, it } from 'vitest';
import type { BackendAction, BackendInterface } from '../../src/Backend/Backend';
import BackendRequest from '../../src/Backend/BackendRequest';
import type BackendResponse from '../../src/Backend/BackendResponse';
@@ -13,7 +14,7 @@ interface MockBackend extends BackendInterface {
const makeTestComponent = (): { component: Component; backend: MockBackend } => {
const backend: MockBackend = {
actions: [],
- makeRequest(data: any, actions: BackendAction[]): BackendRequest {
+ makeRequest(_data: any, actions: BackendAction[]): BackendRequest {
this.actions = actions;
return new BackendRequest(
diff --git a/src/LiveComponent/assets/test/ComponentRegistry.test.ts b/src/LiveComponent/assets/test/ComponentRegistry.test.ts
index 3d1867deb27..4156e3cbcc7 100644
--- a/src/LiveComponent/assets/test/ComponentRegistry.test.ts
+++ b/src/LiveComponent/assets/test/ComponentRegistry.test.ts
@@ -1,4 +1,5 @@
import { Response } from 'node-fetch';
+import { beforeEach, describe, expect, it } from 'vitest';
import type { BackendInterface } from '../src/Backend/Backend';
import BackendRequest from '../src/Backend/BackendRequest';
import Component from '../src/Component';
diff --git a/src/LiveComponent/assets/test/Directive/directives_parser.test.ts b/src/LiveComponent/assets/test/Directive/directives_parser.test.ts
index b0488b88583..474a01e5a00 100644
--- a/src/LiveComponent/assets/test/Directive/directives_parser.test.ts
+++ b/src/LiveComponent/assets/test/Directive/directives_parser.test.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it } from 'vitest';
import { type Directive, parseDirectives } from '../../src/Directive/directives_parser';
const assertDirectiveEquals = (actual: Directive, expected: any) => {
diff --git a/src/LiveComponent/assets/test/Directive/get_model_binding.test.ts b/src/LiveComponent/assets/test/Directive/get_model_binding.test.ts
index d2c0ee07fcd..a78555afa4b 100644
--- a/src/LiveComponent/assets/test/Directive/get_model_binding.test.ts
+++ b/src/LiveComponent/assets/test/Directive/get_model_binding.test.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it } from 'vitest';
import { parseDirectives } from '../../src/Directive/directives_parser';
import getModelBinding from '../../src/Directive/get_model_binding';
diff --git a/src/LiveComponent/assets/test/Rendering/ChangingItemsTracker.test.ts b/src/LiveComponent/assets/test/Rendering/ChangingItemsTracker.test.ts
index fbf3ed0971c..5318ca79b72 100644
--- a/src/LiveComponent/assets/test/Rendering/ChangingItemsTracker.test.ts
+++ b/src/LiveComponent/assets/test/Rendering/ChangingItemsTracker.test.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it } from 'vitest';
import ChangingItemsTracker from '../../src/Rendering/ChangingItemsTracker';
describe('ChangingItemsTracker', () => {
diff --git a/src/LiveComponent/assets/test/Rendering/ElementChanges.test.ts b/src/LiveComponent/assets/test/Rendering/ElementChanges.test.ts
index d48bfb13186..7be098039df 100644
--- a/src/LiveComponent/assets/test/Rendering/ElementChanges.test.ts
+++ b/src/LiveComponent/assets/test/Rendering/ElementChanges.test.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it } from 'vitest';
import ElementChanges from '../../src/Rendering/ElementChanges';
describe('ElementChanges', () => {
diff --git a/src/LiveComponent/assets/test/Rendering/ExternalMutationTracker.test.ts b/src/LiveComponent/assets/test/Rendering/ExternalMutationTracker.test.ts
index f3a4613279e..98b882e8af6 100644
--- a/src/LiveComponent/assets/test/Rendering/ExternalMutationTracker.test.ts
+++ b/src/LiveComponent/assets/test/Rendering/ExternalMutationTracker.test.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it } from 'vitest';
import { htmlToElement } from '../../src/dom_utils';
import ExternalMutationTracker from '../../src/Rendering/ExternalMutationTracker';
diff --git a/src/LiveComponent/assets/test/UnsyncedInputContainer.test.ts b/src/LiveComponent/assets/test/UnsyncedInputContainer.test.ts
index c7b614de3b7..245a2eb3e19 100644
--- a/src/LiveComponent/assets/test/UnsyncedInputContainer.test.ts
+++ b/src/LiveComponent/assets/test/UnsyncedInputContainer.test.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it } from 'vitest';
import { UnsyncedInputContainer } from '../src/Component/UnsyncedInputsTracker';
import { htmlToElement } from '../src/dom_utils';
diff --git a/src/LiveComponent/assets/test/Util/getElementAsTagText.test.ts b/src/LiveComponent/assets/test/Util/getElementAsTagText.test.ts
index 4bd12b3a907..da7ba3cf205 100644
--- a/src/LiveComponent/assets/test/Util/getElementAsTagText.test.ts
+++ b/src/LiveComponent/assets/test/Util/getElementAsTagText.test.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it } from 'vitest';
import { htmlToElement } from '../../src/dom_utils';
import getElementAsTagText from '../../src/Util/getElementAsTagText';
diff --git a/src/LiveComponent/assets/test/ValueStore.test.ts b/src/LiveComponent/assets/test/ValueStore.test.ts
index 762e8a5223d..bc79641c2f3 100644
--- a/src/LiveComponent/assets/test/ValueStore.test.ts
+++ b/src/LiveComponent/assets/test/ValueStore.test.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it } from 'vitest';
import ValueStore from '../src/Component/ValueStore';
describe('ValueStore', () => {
diff --git a/src/LiveComponent/assets/test/controller/action.test.ts b/src/LiveComponent/assets/test/controller/action.test.ts
index d3e10c1ada8..bbd848980df 100644
--- a/src/LiveComponent/assets/test/controller/action.test.ts
+++ b/src/LiveComponent/assets/test/controller/action.test.ts
@@ -9,6 +9,7 @@
import { getByText, waitFor } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, it } from 'vitest';
import { createTest, initComponent, shutdownTests } from '../tools';
describe('LiveController Action Tests', () => {
diff --git a/src/LiveComponent/assets/test/controller/basic.test.ts b/src/LiveComponent/assets/test/controller/basic.test.ts
index 3b4d149a188..2cf516cfd00 100644
--- a/src/LiveComponent/assets/test/controller/basic.test.ts
+++ b/src/LiveComponent/assets/test/controller/basic.test.ts
@@ -7,6 +7,7 @@
* file that was distributed with this source code.
*/
+import { afterEach, describe, expect, it } from 'vitest';
import Component from '../../src/Component';
import { findComponents } from '../../src/ComponentRegistry';
import { htmlToElement } from '../../src/dom_utils';
diff --git a/src/LiveComponent/assets/test/controller/child-model.test.ts b/src/LiveComponent/assets/test/controller/child-model.test.ts
index 1bfa53a2e4e..4372fdc91ad 100644
--- a/src/LiveComponent/assets/test/controller/child-model.test.ts
+++ b/src/LiveComponent/assets/test/controller/child-model.test.ts
@@ -9,6 +9,7 @@
import { getByTestId, waitFor } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, it } from 'vitest';
import { createTest, initComponent, shutdownTests } from '../tools';
describe('Component parent -> child data-model binding tests', () => {
diff --git a/src/LiveComponent/assets/test/controller/child.test.ts b/src/LiveComponent/assets/test/controller/child.test.ts
index 58f5006090d..bd767b67713 100644
--- a/src/LiveComponent/assets/test/controller/child.test.ts
+++ b/src/LiveComponent/assets/test/controller/child.test.ts
@@ -10,6 +10,7 @@
import { Controller } from '@hotwired/stimulus';
import { getByTestId, waitFor } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, it } from 'vitest';
import { findChildren } from '../../src/ComponentRegistry';
import {
createTest,
diff --git a/src/LiveComponent/assets/test/controller/dispatch-event.test.ts b/src/LiveComponent/assets/test/controller/dispatch-event.test.ts
index e20283e91c1..f56cf2fc47d 100644
--- a/src/LiveComponent/assets/test/controller/dispatch-event.test.ts
+++ b/src/LiveComponent/assets/test/controller/dispatch-event.test.ts
@@ -7,6 +7,7 @@
* file that was distributed with this source code.
*/
+import { afterEach, describe, expect, it } from 'vitest';
import { createTest, initComponent, shutdownTests } from '../tools';
describe('LiveController Event Dispatching Tests', () => {
diff --git a/src/LiveComponent/assets/test/controller/emit.test.ts b/src/LiveComponent/assets/test/controller/emit.test.ts
index 1451f7c963e..2794c880496 100644
--- a/src/LiveComponent/assets/test/controller/emit.test.ts
+++ b/src/LiveComponent/assets/test/controller/emit.test.ts
@@ -8,6 +8,7 @@
*/
import { getByText, waitFor } from '@testing-library/dom';
+import { afterEach, describe, expect, it } from 'vitest';
import { createTest, initComponent, shutdownTests } from '../tools';
describe('LiveController Emit Tests', () => {
diff --git a/src/LiveComponent/assets/test/controller/error.test.ts b/src/LiveComponent/assets/test/controller/error.test.ts
index 70acd75b4ef..d8447e7b218 100644
--- a/src/LiveComponent/assets/test/controller/error.test.ts
+++ b/src/LiveComponent/assets/test/controller/error.test.ts
@@ -8,6 +8,7 @@
*/
import { getByText, waitFor } from '@testing-library/dom';
+import { afterEach, describe, expect, it } from 'vitest';
import type BackendResponse from '../../src/Backend/BackendResponse';
import { createTest, initComponent, shutdownTests } from '../tools';
@@ -108,7 +109,7 @@ describe('LiveController Error Handling', () => {
.expectActionCalled('save');
let isHookCalled = false;
- test.component.on('response:error', (backendResponse: BackendResponse, controls) => {
+ test.component.on('response:error', (_backendResponse: BackendResponse, controls) => {
isHookCalled = true;
controls.displayError = false;
});
diff --git a/src/LiveComponent/assets/test/controller/loading.test.ts b/src/LiveComponent/assets/test/controller/loading.test.ts
index 69236671173..47d8907792c 100644
--- a/src/LiveComponent/assets/test/controller/loading.test.ts
+++ b/src/LiveComponent/assets/test/controller/loading.test.ts
@@ -9,6 +9,7 @@
import { getByTestId, getByText, waitFor } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, it } from 'vitest';
import { createTest, initComponent, shutdownTests } from '../tools';
describe('LiveController data-loading Tests', () => {
@@ -21,7 +22,7 @@ describe('LiveController data-loading Tests', () => {
{ food: 'pizza' },
(data: any) => `
- I like: ${data.food}
+ I like: ${data.food}
Loading...
`
@@ -53,7 +54,7 @@ describe('LiveController data-loading Tests', () => {
{ food: 'pizza' },
(data: any) => `
- I like: ${data.food}
+ I like: ${data.food}
`
@@ -84,7 +85,7 @@ describe('LiveController data-loading Tests', () => {
const test = await createTest(
{},
(data: any) => `
-
+
Loading...
@@ -131,7 +132,7 @@ describe('LiveController data-loading Tests', () => {
const test = await createTest(
{ comments: '', user: { email: '' } },
(data: any) => `
-
+
Comments change loading...
@@ -185,7 +186,7 @@ describe('LiveController data-loading Tests', () => {
const test = await createTest(
{},
(data: any) => `
-
+
Loading...
@@ -215,7 +216,7 @@ describe('LiveController data-loading Tests', () => {
const test = await createTest(
{},
(data: any) => `
-
+
Loading...
diff --git a/src/LiveComponent/assets/test/controller/model.test.ts b/src/LiveComponent/assets/test/controller/model.test.ts
index 63756d9c927..085f2761341 100644
--- a/src/LiveComponent/assets/test/controller/model.test.ts
+++ b/src/LiveComponent/assets/test/controller/model.test.ts
@@ -9,6 +9,7 @@
import { getByLabelText, getByTestId, getByText, waitFor } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, it } from 'vitest';
import { createTest, initComponent, shutdownTests } from '../tools';
describe('LiveController data-model Tests', () => {
diff --git a/src/LiveComponent/assets/test/controller/poll.test.ts b/src/LiveComponent/assets/test/controller/poll.test.ts
index 1519172f394..d45a5b4ca19 100644
--- a/src/LiveComponent/assets/test/controller/poll.test.ts
+++ b/src/LiveComponent/assets/test/controller/poll.test.ts
@@ -9,6 +9,7 @@
import { waitFor } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, it } from 'vitest';
import { createTest, initComponent, shutdownTests } from '../tools';
describe('LiveController polling Tests', () => {
diff --git a/src/LiveComponent/assets/test/controller/query-binding.test.ts b/src/LiveComponent/assets/test/controller/query-binding.test.ts
index f0654efe8e9..cde1fbbf21e 100644
--- a/src/LiveComponent/assets/test/controller/query-binding.test.ts
+++ b/src/LiveComponent/assets/test/controller/query-binding.test.ts
@@ -8,6 +8,7 @@
*/
import { getByText, waitFor } from '@testing-library/dom';
+import { afterEach, describe, expect, it } from 'vitest';
import { createTest, expectCurrentSearch, initComponent, setCurrentSearch, shutdownTests } from '../tools';
describe('LiveController query string binding', () => {
diff --git a/src/LiveComponent/assets/test/controller/render-with-external-changes.test.ts b/src/LiveComponent/assets/test/controller/render-with-external-changes.test.ts
index 7109dcc7e14..b5046e0ee6c 100644
--- a/src/LiveComponent/assets/test/controller/render-with-external-changes.test.ts
+++ b/src/LiveComponent/assets/test/controller/render-with-external-changes.test.ts
@@ -8,6 +8,7 @@
*/
import { getByTestId } from '@testing-library/dom';
+import { afterEach, describe, expect, it } from 'vitest';
import { htmlToElement } from '../../src/dom_utils';
import { createTest, initComponent, shutdownTests } from '../tools';
diff --git a/src/LiveComponent/assets/test/controller/render.test.ts b/src/LiveComponent/assets/test/controller/render.test.ts
index 5dc6c64ddd7..1f69026f45e 100644
--- a/src/LiveComponent/assets/test/controller/render.test.ts
+++ b/src/LiveComponent/assets/test/controller/render.test.ts
@@ -9,6 +9,7 @@
import { getByTestId, getByText, waitFor } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, it } from 'vitest';
import { htmlToElement } from '../../src/dom_utils';
import { createTest, initComponent, shutdownTests } from '../tools';
@@ -51,7 +52,7 @@ describe('LiveController rendering Tests', () => {
We want the first to finish, to see if it overwrites our value
-->
-
+
Title: "${data.title}"
Comment: "${data.comment}"
@@ -213,7 +214,7 @@ describe('LiveController rendering Tests', () => {
(data: any) => `
Inside Ignore Name: ${data.firstName}
-
+
Outside Ignore Name: ${data.firstName}
@@ -249,7 +250,7 @@ describe('LiveController rendering Tests', () => {
Inside Ignore Name: ${data.firstName}
-
+
Outside Ignore Name: ${data.firstName}
@@ -491,8 +492,8 @@ describe('LiveController rendering Tests', () => {
// correctly delayed, the "first render finish" and "second render
// start" times could be the same, because no time has passed.
const sleep = (milliseconds: number) => {
- const startTime = new Date().getTime();
- while (new Date().getTime() < startTime + milliseconds);
+ const startTime = Date.now();
+ while (Date.now() < startTime + milliseconds);
};
sleep(10);
});
@@ -585,7 +586,7 @@ describe('LiveController rendering Tests', () => {
-
+
-
+