Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(site): upgrade msw to 2.0#12597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 16 commits intomainfrombq/upgrade-msw
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
3e0e2e2
wp: upgrade msw
BrunoQuaresmaMar 8, 2024
d385f53
Minor fixes
BrunoQuaresmaMar 8, 2024
41fcf23
Fix polyfill issues and ProxyContext old api usage
BrunoQuaresmaMar 14, 2024
7855226
Fix PortForwardPopoverView tests
BrunoQuaresmaMar 14, 2024
41ccf83
Skip usePaginatedQuery.test
BrunoQuaresmaMar 14, 2024
b641691
Merge branch 'main' of https://github.com/coder/coder into bq/upgrade…
BrunoQuaresmaMar 14, 2024
c5f758a
Skip usePaginatedQuery test
BrunoQuaresmaMar 14, 2024
3c3db52
Fix fmt
BrunoQuaresmaMar 14, 2024
723ccd9
Fix lint
BrunoQuaresmaMar 14, 2024
4c61c01
fix typo
BrunoQuaresmaMar 18, 2024
a70d24c
Remove ynecessary async
BrunoQuaresmaMar 18, 2024
8f5748a
Merge branch 'main' of https://github.com/coder/coder into bq/upgrade…
BrunoQuaresmaMar 18, 2024
374f6c4
Fix metadata stuff
BrunoQuaresmaMar 18, 2024
089680d
Improve type
BrunoQuaresmaMar 18, 2024
538f1e2
Merge branch 'main' of https://github.com/coder/coder into bq/upgrade…
BrunoQuaresmaMar 18, 2024
d5d8788
Merge branch 'main' of https://github.com/coder/coder into bq/upgrade…
BrunoQuaresmaMar 19, 2024
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
2 changes: 2 additions & 0 deletionssite/.eslintrc.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,8 @@ env:
es6: true
jest: true
node: true
ignorePatterns:
- "jest.polyfills.js"
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
Expand Down
13 changes: 12 additions & 1 deletionsite/jest.config.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,7 @@ module.exports = {
{
displayName: "test",
roots: ["<rootDir>"],
setupFiles: ["./jest.polyfills.js"],
setupFilesAfterEnv: ["./jest.setup.ts"],
extensionsToTreatAsEsm: [".ts"],
transform: {
Expand All@@ -27,8 +28,18 @@ module.exports = {
],
},
testEnvironment: "jsdom",
testEnvironmentOptions: {
customExportConditions: [""],
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
testPathIgnorePatterns: ["/node_modules/", "/e2e/"],
testPathIgnorePatterns: [
"/node_modules/",
"/e2e/",
// TODO: This test is timing out after upgrade a few Jest dependencies
// and I was not able to figure out why. When running it specifically, I
// can see many act warnings that may can help us to find the issue.
"/usePaginatedQuery.test.ts",
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@Parkreiner I may need your help with this 🙏 I created a separated issue to not block this one#12598

buenos-nachos reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No worries! Happy to take a look tomorrow after Backstage launch

BrunoQuaresma reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

rather than temporarily ignore the file, can we usetest.failing on the tests in the file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Oh, I didn't realize that was an option. Definitely think we should go with that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

buenos-nachos reacted with heart emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

For some reason,describe.skip ortest.failure are not working 😢 it just hangs forever

Screen.Recording.2024-03-14.at.14.54.43.mov

Ps: I tried to post a longer video but GH didn't allow me because of the size.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

that's annoying... what happens if you add an empty non-skipped test?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

it just hangs... I think there is some weird thing happening on this test 🤔

],
transformIgnorePatterns: [
"<rootDir>/node_modules/@chartjs-adapter-date-fns",
],
Expand Down
32 changes: 32 additions & 0 deletionssite/jest.polyfills.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
/**
* Necessary for MSW
*
* @note The block below contains polyfills for Node.js globals
* required for Jest to function when running JSDOM tests.
* These HAVE to be require's and HAVE to be in this exact
* order, since "undici" depends on the "TextEncoder" global API.
*
* Consider migrating to a more modern test runner if
* you don't want to deal with this.
*/
const { TextDecoder, TextEncoder } = require("node:util");
const { ReadableStream } = require("node:stream/web");

Object.defineProperties(globalThis, {
TextDecoder: { value: TextDecoder },
TextEncoder: { value: TextEncoder },
ReadableStream: { value: ReadableStream },
});

const { Blob, File } = require("node:buffer");
const { fetch, Headers, FormData, Request, Response } = require("undici");

Object.defineProperties(globalThis, {
fetch: { value: fetch, writable: true },
Blob: { value: Blob },
File: { value: File },
Headers: { value: Headers },
FormData: { value: FormData },
Request: { value: Request },
Response: { value: Response },
});
10 changes: 0 additions & 10 deletionssite/jest.setup.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
import "@testing-library/jest-dom";
import "jest-location-mock";
import { cleanup } from "@testing-library/react";
import { Blob } from "buffer";
import crypto from "crypto";
import jestFetchMock from "jest-fetch-mock";
import { useMemo } from "react";
import { TextEncoder, TextDecoder } from "util";
import type { Region } from "api/typesGenerated";
import type { ProxyLatencyReport } from "contexts/useProxyLatency";
import { server } from "testHelpers/server";

jestFetchMock.enableMocks();

// useProxyLatency does some http requests to determine latency.
// This would fail unit testing, or at least make it very slow with
// actual network requests. So just globally mock this hook.
Expand DownExpand Up@@ -42,11 +37,6 @@ jest.mock("contexts/useProxyLatency", () => ({
},
}));

global.TextEncoder = TextEncoder;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Polyfill for jsdom
global.TextDecoder = TextDecoder as any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Polyfill for jsdom
global.Blob = Blob as any;
global.scrollTo = jest.fn();

window.HTMLElement.prototype.scrollIntoView = jest.fn();
Expand Down
4 changes: 2 additions & 2 deletionssite/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,6 +82,7 @@
"tzdata": "1.0.30",
"ua-parser-js": "1.0.33",
"ufuzzy": "npm:@leeoniya/ufuzzy@1.0.10",
"undici": "6.7.1",
"unique-names-generator": "4.7.1",
"uuid": "9.0.0",
"xterm": "5.2.0",
Expand DownExpand Up@@ -151,12 +152,11 @@
"jest": "29.6.2",
"jest-canvas-mock": "2.5.2",
"jest-environment-jsdom": "29.5.0",
"jest-fetch-mock": "3.0.3",
"jest-location-mock": "2.0.0",
"jest-runner-eslint": "2.1.0",
"jest-websocket-mock": "2.5.0",
"jest_workaround": "0.1.14",
"msw": "1.3.0",
"msw": "2.2.3",
"prettier": "3.1.0",
"protobufjs": "7.2.4",
"rxjs": "7.8.1",
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp