attempt to fix test

This commit is contained in:
kakkokari-gtyih 2025-06-13 21:44:53 +09:00
parent 0770ee82eb
commit c306cdbdd9
6 changed files with 22 additions and 10 deletions

View File

@ -136,7 +136,7 @@ module.exports = {
// runner: "jest-runner", // runner: "jest-runner",
// The paths to modules that run some code to configure or set up the testing environment before each test // The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [], setupFiles: ["<rootDir>/test/jest.setup.ts"],
// A list of paths to modules that run some code to configure or set up the testing framework before each test // A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [], // setupFilesAfterEnv: [],
@ -151,9 +151,7 @@ module.exports = {
testEnvironment: "node", testEnvironment: "node",
// Options that will be passed to the testEnvironment // Options that will be passed to the testEnvironment
testEnvironmentOptions: { // testEnvironmentOptions: {},
globalsCleanup: 'soft', // Soft cleanup mode to avoid issues with global variables in tests
},
// Adds a location field to test results // Adds a location field to test results
// testLocationInResults: false, // testLocationInResults: false,

View File

@ -8,7 +8,7 @@ const base = require('./jest.config.cjs')
module.exports = { module.exports = {
...base, ...base,
globalSetup: "<rootDir>/built-test/entry.js", globalSetup: "<rootDir>/built-test/entry.js",
setupFilesAfterEnv: ["<rootDir>/test/jest.setup.ts"], setupFilesAfterEnv: ["<rootDir>/test/jest.setup.e2e.ts"],
testMatch: [ testMatch: [
"<rootDir>/test/e2e/**/*.ts", "<rootDir>/test/e2e/**/*.ts",
], ],

View File

@ -236,6 +236,7 @@
"fkill": "9.0.0", "fkill": "9.0.0",
"jest": "30.0.0", "jest": "30.0.0",
"jest-mock": "30.0.0", "jest-mock": "30.0.0",
"jest-util": "30.0.0",
"nodemon": "3.1.10", "nodemon": "3.1.10",
"pid-port": "1.0.2", "pid-port": "1.0.2",
"simple-oauth2": "5.1.0", "simple-oauth2": "5.1.0",

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { initTestDb, sendEnvResetRequest } from './utils.js';
beforeAll(async () => {
await initTestDb(false);
await sendEnvResetRequest();
});

View File

@ -3,9 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { initTestDb, sendEnvResetRequest } from './utils.js'; import { protectProperties } from 'jest-util';
beforeAll(async () => { protectProperties(globalThis.ReadableStreamDefaultReader);
await initTestDb(false); protectProperties(globalThis.ReadableStreamBYOBReader);
await sendEnvResetRequest(); protectProperties(globalThis.WritableStreamDefaultWriter);
});

View File

@ -589,6 +589,9 @@ importers:
jest-mock: jest-mock:
specifier: 30.0.0 specifier: 30.0.0
version: 30.0.0 version: 30.0.0
jest-util:
specifier: 30.0.0
version: 30.0.0
nodemon: nodemon:
specifier: 3.1.10 specifier: 3.1.10
version: 3.1.10 version: 3.1.10