Browse Source

remove jest files and descriptions

Yuki Takei 2 months ago
parent
commit
971bfce556

+ 1 - 6
.serena/memories/coding_conventions.md

@@ -49,13 +49,8 @@ vitest.workspace.mts の設定に基づく:
 
 
 ## ディレクトリ構造の規則
 ## ディレクトリ構造の規則
 - `src/`: ソースコード
 - `src/`: ソースコード
-- `test/`: Jest用の古いテストファイル(廃止予定)
-- `test-with-vite/`: Vitest用の新しいテストファイル
+- `test-with-vite/`: Vitest用のファイル
 - `playwright/`: E2Eテストファイル
 - `playwright/`: E2Eテストファイル
 - `config/`: 設定ファイル
 - `config/`: 設定ファイル
 - `public/`: 静的ファイル
 - `public/`: 静的ファイル
 - `dist/`: ビルド出力
 - `dist/`: ビルド出力
-
-## 移行ガイドライン
-- 新規開発: Biome + Vitest を使用
-- 既存コード: 段階的に Jest → Vitest に移行

+ 3 - 9
.serena/memories/project_structure.md

@@ -25,8 +25,7 @@ growi/
 ```
 ```
 apps/app/
 apps/app/
 ├── src/                   # ソースコード
 ├── src/                   # ソースコード
-├── test/                  # 古いJestテストファイル(廃止予定)
-├── test-with-vite/        # 新しいVitestテストファイル
+├── test-with-vite/        # Vitest用ファイル
 ├── playwright/            # E2Eテスト(Playwright)
 ├── playwright/            # E2Eテスト(Playwright)
 ├── config/                # 設定ファイル
 ├── config/                # 設定ファイル
 ├── public/                # 静的ファイル
 ├── public/                # 静的ファイル
@@ -37,14 +36,9 @@ apps/app/
 
 
 ## テストディレクトリの詳細
 ## テストディレクトリの詳細
 
 
-### test/ (廃止予定)
-- Jest用の古いテストファイル
-- 段階的にtest-with-vite/に移行予定
-- 新規テストは作成しない
-
 ### test-with-vite/
 ### test-with-vite/
-- Vitest用の新しいテストファイル
-- 新規テストはここに作成
+- Vitest用のファイル
+- 新規テスト用のユーティリティはここに作成
 - セットアップファイル: `setup/mongoms.ts` (MongoDB用)
 - セットアップファイル: `setup/mongoms.ts` (MongoDB用)
 
 
 ### playwright/
 ### playwright/

+ 4 - 5
.serena/memories/tech_stack.md

@@ -9,11 +9,10 @@
 - **Jotai**: アトミック状態管理(推奨)
 - **Jotai**: アトミック状態管理(推奨)
 - **SWR** ^2.3.2: データフェッチ・キャッシュ
 - **SWR** ^2.3.2: データフェッチ・キャッシュ
 
 
-## 開発ツール移行状況
-| 従来 | 移行先 | 状況 |
-|------|--------|------|
-| ESLint | **Biome** | 新規推奨 |
-| Jest | **Vitest** + **Playwright** | 新規推奨 |
+## 開発ツール
+- **Biome**: フォーマッター、リンター
+- **Vitest**: テストフレームワーク
+- **Playwright**: e2eテストフレームワーク
 
 
 ## 主要コマンド
 ## 主要コマンド
 ```bash
 ```bash

+ 0 - 18
.serena/memories/vitest-testing-tips-and-best-practices.md

@@ -75,21 +75,3 @@ pnpm run test:vitest:coverage
 # 特定ファイルのみ実行(coverageあり)
 # 特定ファイルのみ実行(coverageあり)
 pnpm run test:vitest src/path/to/test.spec.tsx
 pnpm run test:vitest src/path/to/test.spec.tsx
 ```
 ```
-
-### package.jsonスクリプト参照
-```json
-{
-  "scripts": {
-    "test": "run-p test:*",
-    "test:jest": "cross-env NODE_ENV=test TS_NODE_PROJECT=test/integration/tsconfig.json jest",
-    "test:vitest": "vitest run --coverage"
-  }
-}
-```
-
-## Jest→Vitest移行要点
-- `jest.config.js` → `vitest.config.ts`
-- `@types/jest` → `vitest/globals`
-- ESModulesネイティブサポート → 高速起動・実行
-
-この設定により型安全性と保守性を両立した高品質テストが可能。

+ 1 - 2
AGENTS.md

@@ -37,11 +37,10 @@ GROWI is a team collaboration software using markdown - a wiki platform with hie
 - `cd apps/app && pnpm run dev:migrate:down` - Rollback last migration
 - `cd apps/app && pnpm run dev:migrate:down` - Rollback last migration
 
 
 ### Testing and Quality
 ### Testing and Quality
-- `turbo run test @apps/app` - Run Jest and Vitest test suites with coverage
+- `turbo run test @apps/app` - Run Vitest test suites with coverage
 - `turbo run lint @apps/app` - Run all linters (TypeScript, Biome, Stylelint, OpenAPI)
 - `turbo run lint @apps/app` - Run all linters (TypeScript, Biome, Stylelint, OpenAPI)
 - `cd apps/app && pnpm run lint:typecheck` - TypeScript type checking only
 - `cd apps/app && pnpm run lint:typecheck` - TypeScript type checking only
 - `cd apps/app && pnpm run test:vitest` - Run Vitest unit tests
 - `cd apps/app && pnpm run test:vitest` - Run Vitest unit tests
-- `cd apps/app && pnpm run test:jest` - Run Jest integration tests
 
 
 ### Development Utilities  
 ### Development Utilities  
 - `cd apps/app && pnpm run repl` - Start Node.js REPL with application context loaded
 - `cd apps/app && pnpm run repl` - Start Node.js REPL with application context loaded

+ 1 - 1
apps/app/AGENTS.md

@@ -42,7 +42,7 @@ This guide provides comprehensive documentation for AI coding agents working on
   - **Unstated**: Legacy (being phased out, replaced by Jotai)
   - **Unstated**: Legacy (being phased out, replaced by Jotai)
 - **Testing**: 
 - **Testing**: 
   - Vitest for unit tests (`*.spec.ts`, `*.spec.tsx`)
   - Vitest for unit tests (`*.spec.ts`, `*.spec.tsx`)
-  - Jest for integration tests (`*.integ.ts`)
+  - Vitest for integration tests (`*.integ.ts`)
   - React Testing Library for component testing
   - React Testing Library for component testing
   - Playwright for E2E testing
   - Playwright for E2E testing
 - **i18n**: next-i18next for internationalization
 - **i18n**: next-i18next for internationalization

+ 0 - 86
apps/app/jest.config.js

@@ -1,86 +0,0 @@
-// For a detailed explanation regarding each configuration property, visit:
-// https://jestjs.io/docs/en/configuration.html
-
-const MODULE_NAME_MAPPING = {
-  '^\\^/(.+)$': '<rootDir>/$1',
-  '^~/(.+)$': '<rootDir>/src/$1',
-};
-
-module.exports = {
-  // Indicates whether each individual test should be reported during the run
-  verbose: true,
-
-  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
-
-  projects: [
-    {
-      displayName: 'server',
-
-      transform: {
-        '^.+\\.(t|j)sx?$': '@swc-node/jest',
-      },
-
-      rootDir: '.',
-      roots: ['<rootDir>'],
-      testMatch: [
-        '<rootDir>/test/integration/**/*.test.ts',
-        '<rootDir>/test/integration/**/*.test.js',
-      ],
-      // https://regex101.com/r/jTaxYS/1
-      modulePathIgnorePatterns: [
-        '<rootDir>/test/integration/*.*/v5(..*)*.[t|j]s',
-      ],
-      testEnvironment: 'node',
-      globalSetup: '<rootDir>/test/integration/global-setup.js',
-      globalTeardown: '<rootDir>/test/integration/global-teardown.js',
-      setupFilesAfterEnv: ['<rootDir>/test/integration/setup.js'],
-
-      // Automatically clear mock calls and instances between every test
-      clearMocks: true,
-      moduleNameMapper: MODULE_NAME_MAPPING,
-    },
-    {
-      displayName: 'server-v5',
-
-      transform: {
-        '^.+\\.(t|j)sx?$': '@swc-node/jest',
-      },
-
-      rootDir: '.',
-      roots: ['<rootDir>'],
-      testMatch: [
-        '<rootDir>/test/integration/**/v5.*.test.ts',
-        '<rootDir>/test/integration/**/v5.*.test.js',
-      ],
-
-      testEnvironment: 'node',
-      globalSetup: '<rootDir>/test/integration/global-setup.js',
-      globalTeardown: '<rootDir>/test/integration/global-teardown.js',
-      setupFilesAfterEnv: ['<rootDir>/test/integration/setup.js'],
-
-      // Automatically clear mock calls and instances between every test
-      clearMocks: true,
-      moduleNameMapper: MODULE_NAME_MAPPING,
-    },
-  ],
-
-  // Automatically clear mock calls and instances between every test
-  clearMocks: true,
-
-  // Indicates whether the coverage information should be collected while executing the test
-  collectCoverage: true,
-
-  // An array of glob patterns indicating a set of files for which coverage information should be collected
-  // collectCoverageFrom: undefined,
-
-  // The directory where Jest should output its coverage files
-  coverageDirectory: 'coverage',
-
-  // An array of regexp pattern strings used to skip coverage collection
-  coveragePathIgnorePatterns: [
-    'index.ts',
-    '/config/',
-    '/resource/',
-    '/node_modules/',
-  ],
-};

+ 1 - 9
apps/app/package.json

@@ -34,11 +34,9 @@
     "lint": "run-p lint:**",
     "lint": "run-p lint:**",
     "prelint:openapi:apiv3": "pnpm run openapi:generate-spec:apiv3",
     "prelint:openapi:apiv3": "pnpm run openapi:generate-spec:apiv3",
     "prelint:openapi:apiv1": "pnpm run openapi:generate-spec:apiv1",
     "prelint:openapi:apiv1": "pnpm run openapi:generate-spec:apiv1",
-    "test": "run-p test:jest test:vitest:coverage",
-    "test:jest": "cross-env NODE_ENV=test TS_NODE_PROJECT=test/integration/tsconfig.json jest",
+    "test": "pnpm run test:vitest:coverage",
     "test:vitest": "vitest run",
     "test:vitest": "vitest run",
     "test:vitest:coverage": "COLUMNS=200 vitest run --coverage",
     "test:vitest:coverage": "COLUMNS=200 vitest run --coverage",
-    "jest:run": "cross-env NODE_ENV=test TS_NODE_PROJECT=test/integration/tsconfig.json jest --passWithNoTests -- ",
     "reg:run": "reg-suit run",
     "reg:run": "reg-suit run",
     "//// misc": "",
     "//// misc": "",
     "console": "npm run repl",
     "console": "npm run repl",
@@ -274,8 +272,6 @@
     "@headless-tree/react": "^1.5.1",
     "@headless-tree/react": "^1.5.1",
     "@next/bundle-analyzer": "^14.1.3",
     "@next/bundle-analyzer": "^14.1.3",
     "@popperjs/core": "^2.11.8",
     "@popperjs/core": "^2.11.8",
-    "@swc-node/jest": "^1.8.1",
-    "@swc/jest": "^0.2.36",
     "@tanstack/react-virtual": "^3.13.12",
     "@tanstack/react-virtual": "^3.13.12",
     "@testing-library/jest-dom": "^6.5.0",
     "@testing-library/jest-dom": "^6.5.0",
     "@testing-library/user-event": "^14.5.2",
     "@testing-library/user-event": "^14.5.2",
@@ -283,7 +279,6 @@
     "@types/bunyan": "^1.8.11",
     "@types/bunyan": "^1.8.11",
     "@types/express": "^4.17.21",
     "@types/express": "^4.17.21",
     "@types/hast": "^3.0.4",
     "@types/hast": "^3.0.4",
-    "@types/jest": "^29.5.2",
     "@types/js-cookie": "^3.0.6",
     "@types/js-cookie": "^3.0.6",
     "@types/ldapjs": "^2.2.5",
     "@types/ldapjs": "^2.2.5",
     "@types/mdast": "^4.0.4",
     "@types/mdast": "^4.0.4",
@@ -316,9 +311,6 @@
     "i18next-hmr": "^3.1.3",
     "i18next-hmr": "^3.1.3",
     "i18next-http-backend": "^2.6.2",
     "i18next-http-backend": "^2.6.2",
     "i18next-localstorage-backend": "^4.2.0",
     "i18next-localstorage-backend": "^4.2.0",
-    "jest": "^29.5.0",
-    "jest-date-mock": "^1.0.8",
-    "jest-localstorage-mock": "^2.4.14",
     "jotai-devtools": "^0.11.0",
     "jotai-devtools": "^0.11.0",
     "load-css-file": "^1.0.0",
     "load-css-file": "^1.0.0",
     "material-icons": "^1.11.3",
     "material-icons": "^1.11.3",

+ 0 - 143
apps/app/test/integration/global-setup.js

@@ -1,143 +0,0 @@
-import mongoose from 'mongoose';
-
-import { getMongoUri, mongoOptions } from '~/server/util/mongoose-utils';
-
-// check env
-if (process.env.NODE_ENV !== 'test') {
-  throw new Error("'process.env.NODE_ENV' must be 'test'");
-}
-
-module.exports = async () => {
-  await mongoose.connect(getMongoUri(), mongoOptions);
-
-  // drop database
-  await mongoose.connection.dropDatabase();
-
-  // init DB
-  const pageCollection = mongoose.connection.collection('pages');
-  const userCollection = mongoose.connection.collection('users');
-  const userGroupCollection = mongoose.connection.collection('usergroups');
-  const userGroupRelationsCollection =
-    mongoose.connection.collection('usergrouprelations');
-
-  // create global user & rootPage
-  const globalUser = (
-    await userCollection.insertMany([
-      {
-        name: 'globalUser',
-        username: 'globalUser',
-        email: 'globalUser@example.com',
-      },
-    ])
-  )[0];
-  const gGroupUserId1 = new mongoose.Types.ObjectId();
-  const gGroupUserId2 = new mongoose.Types.ObjectId();
-  const gGroupUserId3 = new mongoose.Types.ObjectId();
-
-  await userCollection.insertMany([
-    {
-      name: 'v5DummyUser1',
-      username: 'v5DummyUser1',
-      email: 'v5DummyUser1@example.com',
-    },
-    {
-      name: 'v5DummyUser2',
-      username: 'v5DummyUser2',
-      email: 'v5DummyUser2@example.com',
-    },
-    {
-      _id: gGroupUserId1,
-      name: 'gGroupUser1',
-      username: 'gGroupUser1',
-      email: 'gGroupUser1@example.com',
-    },
-    {
-      _id: gGroupUserId2,
-      name: 'gGroupUser2',
-      username: 'gGroupUser2',
-      email: 'gGroupUser2@example.com',
-    },
-    {
-      _id: gGroupUserId3,
-      name: 'gGroupUser3',
-      username: 'gGroupUser3',
-      email: 'gGroupUser3@example.com',
-    },
-  ]);
-  const gGroupIdIsolate = new mongoose.Types.ObjectId();
-  const gGroupIdA = new mongoose.Types.ObjectId();
-  const gGroupIdB = new mongoose.Types.ObjectId();
-  const gGroupIdC = new mongoose.Types.ObjectId();
-  await userGroupCollection.insertMany([
-    {
-      _id: gGroupIdIsolate,
-      name: 'globalGroupIsolate',
-    },
-    {
-      _id: gGroupIdA,
-      name: 'globalGroupA',
-    },
-    {
-      _id: gGroupIdB,
-      name: 'globalGroupB',
-      parent: gGroupIdA,
-    },
-    {
-      _id: gGroupIdC,
-      name: 'globalGroupC',
-      parent: gGroupIdB,
-    },
-  ]);
-  await userGroupRelationsCollection.insertMany([
-    {
-      relatedGroup: gGroupIdIsolate,
-      relatedUser: gGroupUserId1,
-      createdAt: new Date(),
-    },
-    {
-      relatedGroup: gGroupIdIsolate,
-      relatedUser: gGroupUserId2,
-      createdAt: new Date(),
-    },
-    {
-      relatedGroup: gGroupIdA,
-      relatedUser: gGroupUserId1,
-      createdAt: new Date(),
-    },
-    {
-      relatedGroup: gGroupIdA,
-      relatedUser: gGroupUserId2,
-      createdAt: new Date(),
-    },
-    {
-      relatedGroup: gGroupIdA,
-      relatedUser: gGroupUserId3,
-      createdAt: new Date(),
-    },
-    {
-      relatedGroup: gGroupIdB,
-      relatedUser: gGroupUserId2,
-      createdAt: new Date(),
-    },
-    {
-      relatedGroup: gGroupIdB,
-      relatedUser: gGroupUserId3,
-      createdAt: new Date(),
-    },
-    {
-      relatedGroup: gGroupIdC,
-      relatedUser: gGroupUserId3,
-      createdAt: new Date(),
-    },
-  ]);
-  await pageCollection.insertMany([
-    {
-      path: '/',
-      grant: 1,
-      creator: globalUser,
-      lastUpdateUser: globalUser,
-    },
-  ]);
-
-  await mongoose.disconnect();
-};

+ 0 - 8
apps/app/test/integration/global-teardown.js

@@ -1,8 +0,0 @@
-/** **********************************************************
- *                           Caution
- *
- * Module aliases by compilerOptions.paths in tsconfig.json
- * are NOT available in setup scripts
- *********************************************************** */
-
-module.exports = async () => {};

+ 0 - 41
apps/app/test/integration/setup-crowi.ts

@@ -1,41 +0,0 @@
-import { Server } from 'node:http';
-
-import Crowi from '../../src/server/crowi';
-import { setupModelsDependentOnCrowi } from '../../src/server/crowi/setup-models';
-
-let _instance: Crowi;
-
-const initCrowi = async (crowi: Crowi) => {
-  crowi.models = await setupModelsDependentOnCrowi(crowi);
-  await crowi.setupConfigManager();
-
-  await crowi.setupSocketIoService();
-  await crowi.socketIoService.attachServer(new Server()); // attach dummy server
-
-  await Promise.all([crowi.setUpApp()]);
-
-  await Promise.all([
-    crowi.setupPassport(),
-    crowi.setupAttachmentService(),
-    crowi.setUpAcl(),
-    crowi.setupPageService(),
-    crowi.setupInAppNotificationService(),
-    crowi.setupActivityService(),
-    crowi.setupUserGroupService(),
-  ]);
-};
-
-export async function getInstance(isNewInstance?: boolean): Promise<Crowi> {
-  if (isNewInstance) {
-    const crowi = new Crowi();
-    await initCrowi(crowi);
-    return crowi;
-  }
-
-  // initialize singleton instance
-  if (_instance == null) {
-    _instance = new Crowi();
-    await initCrowi(_instance);
-  }
-  return _instance;
-}

+ 0 - 26
apps/app/test/integration/setup.js

@@ -1,26 +0,0 @@
-/** **********************************************************
- *                           Caution
- *
- * Module aliases by compilerOptions.paths in tsconfig.json
- * are NOT available in setup scripts
- *********************************************************** */
-
-const gc = require('expose-gc/function');
-const mongoose = require('mongoose');
-
-const { getMongoUri, mongoOptions } = require('~/server/util/mongoose-utils');
-
-mongoose.Promise = global.Promise;
-
-jest.setTimeout(30000); // default 5000
-
-beforeAll(async () => {
-  await mongoose.connect(getMongoUri(), mongoOptions);
-});
-
-afterAll(async () => {
-  await mongoose.disconnect();
-  gc();
-});
-
-module.exports = {};

+ 0 - 7
apps/app/test/integration/tsconfig.json

@@ -1,7 +0,0 @@
-{
-  "extends": "../../tsconfig.json",
-  "compilerOptions": {
-    "module": "CommonJS",
-    "types": ["@types/jest"]
-  }
-}

File diff suppressed because it is too large
+ 6 - 605
pnpm-lock.yaml


Some files were not shown because too many files changed in this diff