revert: "build: Migrate to Vite 🚀" (#6814)

Revert "build: Migrate to Vite 🚀 (#6713)"

This reverts commit e93bbc5776.
This commit is contained in:
Aakansha Doshi
2023-07-26 22:34:06 +05:30
committed by GitHub
parent dcc75ed007
commit 8104068bd5
100 changed files with 9758 additions and 6012 deletions

View File

@ -20,21 +20,21 @@ import ExcalidrawApp from "../excalidraw-app";
import { mutateElement } from "../element/mutateElement";
import { NormalizedZoomValue } from "../types";
import { ROUNDNESS } from "../constants";
import { vi } from "vitest";
import * as blob from "../data/blob";
const { h } = window;
const mouse = new Pointer("mouse");
// This needs to fixed in vitest mock, as when importActual used with mock
// the tests hangs - https://github.com/vitest-dev/vitest/issues/546.
// But fortunately spying and mocking the return value of spy works :p
const resizeImageFileSpy = vi.spyOn(blob, "resizeImageFile");
const generateIdFromFileSpy = vi.spyOn(blob, "generateIdFromFile");
resizeImageFileSpy.mockImplementation(async (imageFile: File) => imageFile);
generateIdFromFileSpy.mockImplementation(async () => "fileId" as FileId);
jest.mock("../data/blob", () => {
const originalModule = jest.requireActual("../data/blob");
//Prevent Node.js modules errors (document is not defined etc...)
return {
__esModule: true,
...originalModule,
resizeImageFile: (imageFile: File) => imageFile,
generateIdFromFile: () => "fileId" as FileId,
};
});
beforeEach(async () => {
// Unmount ReactDOM from root
ReactDOM.unmountComponentAtNode(document.getElementById("root")!);
@ -42,7 +42,7 @@ beforeEach(async () => {
mouse.reset();
localStorage.clear();
sessionStorage.clear();
vi.clearAllMocks();
jest.clearAllMocks();
Object.assign(document, {
elementFromPoint: () => GlobalTestState.canvas,
@ -732,6 +732,7 @@ describe("image", () => {
it("flips an unrotated image horizontally correctly", async () => {
//paste image
await createImage();
await waitFor(() => {
expect((h.elements[0] as ExcalidrawImageElement).scale).toEqual([1, 1]);
expect(API.getSelectedElements().length).toBeGreaterThan(0);