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
@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Excalidraw/> > <MainMenu/> > should render main menu with host menu items if passed from host 1`] = `
exports[`<Excalidraw/> <MainMenu/> should render main menu with host menu items if passed from host 1`] = `
<div
class="dropdown-menu"
data-testid="dropdown-menu"
@@ -108,7 +108,7 @@ exports[`<Excalidraw/> > <MainMenu/> > should render main menu with host menu it
</div>
`;
exports[`<Excalidraw/> > Test UIOptions prop > Test canvasActions > should render menu with default items when "UIOPtions" is "undefined" 1`] = `
exports[`<Excalidraw/> Test UIOptions prop Test canvasActions should render menu with default items when "UIOPtions" is "undefined" 1`] = `
<div
class="dropdown-menu"
data-testid="dropdown-menu"
@@ -1,9 +1,9 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`exportToSvg > with default arguments 1`] = `
{
exports[`exportToSvg with default arguments 1`] = `
Object {
"activeEmbeddable": null,
"activeTool": {
"activeTool": Object {
"customType": null,
"lastActiveTool": null,
"locked": false,
@@ -40,7 +40,7 @@ exports[`exportToSvg > with default arguments 1`] = `
"exportScale": 1,
"exportWithDarkMode": false,
"fileHandle": null,
"frameRendering": {
"frameRendering": Object {
"clip": true,
"enabled": true,
"name": true,
@@ -59,21 +59,21 @@ exports[`exportToSvg > with default arguments 1`] = `
"openMenu": null,
"openPopup": null,
"openSidebar": null,
"pasteDialog": {
"pasteDialog": Object {
"data": null,
"shown": false,
},
"penDetected": false,
"penMode": false,
"pendingImageElementId": null,
"previousSelectedElementIds": {},
"previousSelectedElementIds": Object {},
"resizingElement": null,
"scrollX": 0,
"scrollY": 0,
"scrolledOutside": false,
"selectedElementIds": {},
"selectedElementIds": Object {},
"selectedElementsAreBeingDragged": false,
"selectedGroupIds": {},
"selectedGroupIds": Object {},
"selectedLinearElement": null,
"selectionElement": null,
"shouldCacheIgnoreZoom": false,
@@ -81,13 +81,13 @@ exports[`exportToSvg > with default arguments 1`] = `
"showStats": false,
"showWelcomeScreen": false,
"startBoundElement": null,
"suggestedBindings": [],
"suggestedBindings": Array [],
"theme": "light",
"toast": null,
"viewBackgroundColor": "#ffffff",
"viewModeEnabled": false,
"zenModeEnabled": false,
"zoom": {
"zoom": Object {
"value": 1,
},
}
+4 -6
View File
@@ -1,6 +1,6 @@
import { fireEvent, GlobalTestState, toggleMenu, render } from "../test-utils";
import { Excalidraw, Footer, MainMenu } from "../../packages/excalidraw/index";
import { queryByText, queryByTestId, screen } from "@testing-library/react";
import { queryByText, queryByTestId } from "@testing-library/react";
import { GRID_SIZE, THEME } from "../../constants";
import { t } from "../../i18n";
import { useMemo } from "react";
@@ -42,7 +42,7 @@ describe("<Excalidraw/>", () => {
container.getElementsByClassName("disable-zen-mode--visible").length,
).toBe(0);
expect(h.state.zenModeEnabled).toBe(true);
screen.debug();
fireEvent.contextMenu(GlobalTestState.canvas, {
button: 2,
clientX: 1,
@@ -74,8 +74,7 @@ describe("<Excalidraw/>", () => {
</Footer>
</Excalidraw>,
));
expect(container.querySelector(".footer-center")).toMatchInlineSnapshot(
`
expect(container.querySelector(".footer-center")).toMatchInlineSnapshot(`
<div
class="footer-center zen-mode-transition"
>
@@ -83,8 +82,7 @@ describe("<Excalidraw/>", () => {
This is a custom footer
</div>
</div>
`,
);
`);
});
describe("Test gridModeEnabled prop", () => {
+17 -13
View File
@@ -1,13 +1,15 @@
import * as utils from "../../packages/utils";
import { diagramFactory } from "../fixtures/diagramFixture";
import { vi } from "vitest";
import * as mockedSceneExportUtils from "../../scene/export";
import { MIME_TYPES } from "../../constants";
const exportToSvgSpy = vi.spyOn(mockedSceneExportUtils, "exportToSvg");
jest.mock("../../scene/export", () => ({
__esmodule: true,
...jest.requireActual("../../scene/export"),
exportToSvg: jest.fn(),
}));
describe("exportToCanvas", async () => {
describe("exportToCanvas", () => {
const EXPORT_PADDING = 10;
it("with default arguments", async () => {
@@ -30,9 +32,10 @@ describe("exportToCanvas", async () => {
});
});
describe("exportToBlob", async () => {
describe("exportToBlob", () => {
describe("mime type", () => {
// afterEach(vi.restoreAllMocks);
afterEach(jest.restoreAllMocks);
it("should change image/jpg to image/jpeg", async () => {
const blob = await utils.exportToBlob({
...diagramFactory(),
@@ -45,6 +48,7 @@ describe("exportToBlob", async () => {
});
expect(blob?.type).toBe(MIME_TYPES.jpg);
});
it("should default to image/png", async () => {
const blob = await utils.exportToBlob({
...diagramFactory(),
@@ -53,14 +57,16 @@ describe("exportToBlob", async () => {
});
it("should warn when using quality with image/png", async () => {
const consoleSpy = vi
const consoleSpy = jest
.spyOn(console, "warn")
.mockImplementationOnce(() => void 0);
await utils.exportToBlob({
...diagramFactory(),
mimeType: MIME_TYPES.png,
quality: 1,
});
expect(consoleSpy).toHaveBeenCalledWith(
`"quality" will be ignored for "${MIME_TYPES.png}" mimeType`,
);
@@ -69,12 +75,10 @@ describe("exportToBlob", async () => {
});
describe("exportToSvg", () => {
const passedElements = () => exportToSvgSpy.mock.calls[0][0];
const passedOptions = () => exportToSvgSpy.mock.calls[0][1];
afterEach(() => {
vi.clearAllMocks();
});
const mockedExportUtil = mockedSceneExportUtils.exportToSvg as jest.Mock;
const passedElements = () => mockedExportUtil.mock.calls[0][0];
const passedOptions = () => mockedExportUtil.mock.calls[0][1];
afterEach(jest.resetAllMocks);
it("with default arguments", async () => {
await utils.exportToSvg({