Use act from @test-utils in SC (#32432)
* test: use `act` from `@test-utils` in SC * chore: add rules to enforce use of act from `@test-utils`
This commit is contained in:
@@ -30,6 +30,18 @@ module.exports = {
|
|||||||
"react/jsx-key": ["error"],
|
"react/jsx-key": ["error"],
|
||||||
"matrix-org/require-copyright-header": "error",
|
"matrix-org/require-copyright-header": "error",
|
||||||
"react-compiler/react-compiler": "error",
|
"react-compiler/react-compiler": "error",
|
||||||
|
"no-restricted-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
paths: [
|
||||||
|
{
|
||||||
|
name: "react",
|
||||||
|
importNames: ["act"],
|
||||||
|
message: "Please use @test-utils instead.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
* Please see LICENSE files in the repository root for full details.
|
* Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { act } from "react";
|
import React from "react";
|
||||||
import { render, screen } from "@test-utils";
|
import { act, render, screen } from "@test-utils";
|
||||||
import userEvent from "@testing-library/user-event";
|
import userEvent from "@testing-library/user-event";
|
||||||
import { composeStories } from "@storybook/react-vite";
|
import { composeStories } from "@storybook/react-vite";
|
||||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||||
|
|||||||
Reference in New Issue
Block a user