chore: Remove stale Jest references from docs and comments (#12285)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Tom Moor
2026-05-06 21:55:07 -04:00
committed by GitHub
parent 091346dfe8
commit d02659d325
7 changed files with 11 additions and 14 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ There is a web client which is fully responsive and works on mobile devices.
- **`shared/`** - Shared TypeScript types, utilities, and editor components - **`shared/`** - Shared TypeScript types, utilities, and editor components
- **`plugins/`** - Plugin system for extending functionality - **`plugins/`** - Plugin system for extending functionality
- **`public/`** - Static assets served directly - **`public/`** - Static assets served directly
- **Various config files** - TypeScript, Vite, Jest, Prettier, Oxlint configurations - **Various config files** - TypeScript, Vite, Vitest, Prettier, Oxlint configurations
Refer to /docs/ARCHITECTURE.md for detailed architecture documentation. Refer to /docs/ARCHITECTURE.md for detailed architecture documentation.
@@ -152,7 +152,7 @@ yarn sequelize migration:create --name=add-field-to-table
## Testing ## Testing
- Run tests with Jest: - Run tests with Vitest:
```bash ```bash
# Run a specific test file (preferred) # Run a specific test file (preferred)
+2 -2
View File
@@ -61,7 +61,7 @@ can be enabled for all categories by setting `DEBUG=*` or for specific categorie
We aim to have sufficient test coverage for critical parts of the application and aren't aiming for 100% unit test coverage. All API endpoints and anything authentication related should be thoroughly tested. We aim to have sufficient test coverage for critical parts of the application and aren't aiming for 100% unit test coverage. All API endpoints and anything authentication related should be thoroughly tested.
To add new tests, write your tests with [Jest](https://facebook.github.io/jest/) and add a file with `.test.ts` extension next to the tested code. To add new tests, write your tests with [Vitest](https://vitest.dev/) and add a file with `.test.ts` extension next to the tested code.
```shell ```shell
# To run all tests # To run all tests
@@ -72,7 +72,7 @@ make watch
``` ```
Once the test database is created with `make test` you may individually run Once the test database is created with `make test` you may individually run
frontend and backend tests directly with jest: frontend and backend tests directly with vitest:
```shell ```shell
# To run backend tests # To run backend tests
+2 -2
View File
@@ -32,7 +32,7 @@ export default function Fix(target: any): void {
Object.defineProperty(this, propertyKey, { Object.defineProperty(this, propertyKey, {
get() { get() {
// Safety check for Jest serialization - getDataValue may not be available // Safety check for test serialization - getDataValue may not be available
// during serialization for inter-process communication // during serialization for inter-process communication
if (typeof this.getDataValue === "function") { if (typeof this.getDataValue === "function") {
return this.getDataValue(propertyKey); return this.getDataValue(propertyKey);
@@ -41,7 +41,7 @@ export default function Fix(target: any): void {
return this.dataValues?.[propertyKey]; return this.dataValues?.[propertyKey];
}, },
set(value) { set(value) {
// Safety check for Jest serialization - setDataValue may not be available // Safety check for test serialization - setDataValue may not be available
// during serialization for inter-process communication // during serialization for inter-process communication
if (typeof this.setDataValue === "function") { if (typeof this.setDataValue === "function") {
this.setDataValue(propertyKey, value); this.setDataValue(propertyKey, value);
-1
View File
@@ -98,7 +98,6 @@ export default function onerror(app: Koa) {
function wrapInNativeError(err: any): Error { function wrapInNativeError(err: any): Error {
// When dealing with cross-globals a normal `instanceof` check doesn't work properly. // When dealing with cross-globals a normal `instanceof` check doesn't work properly.
// See https://github.com/koajs/koa/issues/1466 // See https://github.com/koajs/koa/issues/1466
// We can probably remove it once jest fixes https://github.com/facebook/jest/issues/2549.
const isNativeError = const isNativeError =
Object.prototype.toString.call(err) === "[object Error]" || Object.prototype.toString.call(err) === "[object Error]" ||
err instanceof Error; err instanceof Error;
+3 -3
View File
@@ -106,7 +106,7 @@ export function createDatabaseInstance(
sequelizeStrictAttributes(instance); sequelizeStrictAttributes(instance);
if (env.isTest) { if (env.isTest) {
instance = monkeyPatchSequelizeErrorsForJest(instance); instance = monkeyPatchSequelizeErrorsForTests(instance);
} }
// Skip queries when the originating HTTP request socket has been destroyed // Skip queries when the originating HTTP request socket has been destroyed
@@ -232,7 +232,7 @@ export function createMigrationRunner(
* Fixed in Sequelize v7, but hasn't been back-ported to Sequelize v6. * Fixed in Sequelize v7, but hasn't been back-ported to Sequelize v6.
* See https://github.com/sequelize/sequelize/issues/14807#issuecomment-1854398131 * See https://github.com/sequelize/sequelize/issues/14807#issuecomment-1854398131
*/ */
export function monkeyPatchSequelizeErrorsForJest(instance: Sequelize) { export function monkeyPatchSequelizeErrorsForTests(instance: Sequelize) {
const sequelizeVersion = (Sequelize as unknown as { version: string }) const sequelizeVersion = (Sequelize as unknown as { version: string })
.version; .version;
const major = sequelizeVersion.split(".").map(Number)[0]; const major = sequelizeVersion.split(".").map(Number)[0];
@@ -251,7 +251,7 @@ export function monkeyPatchSequelizeErrorsForJest(instance: Sequelize) {
try { try {
return await origQueryFunc(...args); return await origQueryFunc(...args);
} catch (err) { } catch (err) {
// Ensure error appears in Jest output, not swallowed by Sequelize internals // Ensure error appears in test output, not swallowed by Sequelize internals
const error = err as Error & { parent?: Error }; const error = err as Error & { parent?: Error };
Logger.error(error.message, error.parent ?? error); Logger.error(error.message, error.parent ?? error);
throw err; throw err;
+1 -2
View File
@@ -41,8 +41,7 @@ vi.mock("@server/utils/MutexLock");
vi.mock("@aws-sdk/signature-v4-crt", () => ({})); vi.mock("@aws-sdk/signature-v4-crt", () => ({}));
// Auto-mock these modules using the corresponding files under server/__mocks__/. // Auto-mock these modules using the corresponding files under server/__mocks__/.
// In Jest, __mocks__ next to a `roots` directory is auto-applied; vitest // Vitest requires an explicit vi.mock() call to wire them up.
// requires an explicit vi.mock() call to wire them up.
vi.mock("bull", () => import("../__mocks__/bull")); vi.mock("bull", () => import("../__mocks__/bull"));
vi.mock("dd-trace", async () => { vi.mock("dd-trace", async () => {
const mod = await import("../__mocks__/dd-trace"); const mod = await import("../__mocks__/dd-trace");
+1 -2
View File
@@ -49,8 +49,7 @@ export default defineConfig({
test: { test: {
globals: true, globals: true,
pool: "threads", pool: "threads",
// Match Jest's default behavior — unhandled promise rejections are // Unhandled promise rejections are logged but don't fail tests on their own.
// logged but don't fail tests on their own.
dangerouslyIgnoreUnhandledErrors: true, dangerouslyIgnoreUnhandledErrors: true,
projects: [ projects: [
{ {