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",
// 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
// setupFilesAfterEnv: [],
@ -151,9 +151,7 @@ module.exports = {
testEnvironment: "node",
// Options that will be passed to the testEnvironment
testEnvironmentOptions: {
globalsCleanup: 'soft', // Soft cleanup mode to avoid issues with global variables in tests
},
// testEnvironmentOptions: {},
// Adds a location field to test results
// testLocationInResults: false,

View File

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

View File

@ -236,6 +236,7 @@
"fkill": "9.0.0",
"jest": "30.0.0",
"jest-mock": "30.0.0",
"jest-util": "30.0.0",
"nodemon": "3.1.10",
"pid-port": "1.0.2",
"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
*/
import { initTestDb, sendEnvResetRequest } from './utils.js';
import { protectProperties } from 'jest-util';
beforeAll(async () => {
await initTestDb(false);
await sendEnvResetRequest();
});
protectProperties(globalThis.ReadableStreamDefaultReader);
protectProperties(globalThis.ReadableStreamBYOBReader);
protectProperties(globalThis.WritableStreamDefaultWriter);

View File

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