Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] fix: 누락된 파일 다시 추가(#62) #63

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ export default {
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
"^@/(.*)": "<rootDir>/src/$1",
},
testEnvironmentOptions: {
customExportConditions: [""],
},
setupFiles: ["./jest.polyfills.js"],
setupFilesAfterEnv: ["./jest.setup.js"],
};
34 changes: 34 additions & 0 deletions frontend/jest.polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @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");

if (globalThis.ReadableStream === undefined) {
globalThis.ReadableStream = ReadableStream;
}

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

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 },
});
14 changes: 7 additions & 7 deletions frontend/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// const { server } = require("@/mocks/server");
const { server } = require("@/mocks/server");

// // 모든 테스트 전에 MSW 서버를 시작합니다.
// beforeAll(() => server.listen());
// 모든 테스트 전에 MSW 서버를 시작합니다.
beforeAll(() => server.listen());

// // 각 테스트 후 MSW 핸들러를 리셋합니다.
// afterEach(() => server.resetHandlers());
// 각 테스트 후 MSW 핸들러를 리셋합니다.
afterEach(() => server.resetHandlers());

// // 모든 테스트 후 MSW 서버를 닫습니다.
// afterAll(() => server.close());
// 모든 테스트 후 MSW 서버를 닫습니다.
afterAll(() => server.close());
Loading
Loading