From 47bd72fa496bb2b1df3ee5f6f96be0948d8fd6a5 Mon Sep 17 00:00:00 2001 From: chenos Date: Tue, 26 Jan 2021 22:44:21 +0800 Subject: [PATCH] fix: jest.setTimeout 300000 --- dotenv.js | 1 + jest.config.js | 2 +- .../src/__tests__/actions/collections.test.ts | 2 +- .../plugin-collections/src/__tests__/models/collection.test.ts | 2 +- packages/plugin-collections/src/__tests__/models/field.test.ts | 2 +- packages/plugin-file-manager/src/__tests__/action.test.ts | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dotenv.js b/dotenv.js index f8518254b..47f343f71 100644 --- a/dotenv.js +++ b/dotenv.js @@ -1 +1,2 @@ +jest.setTimeout(300000); require('dotenv').config(); diff --git a/jest.config.js b/jest.config.js index 6a5639c1f..1d743dc6d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,7 +3,7 @@ const path = require('path'); module.exports = { preset: 'ts-jest', testEnvironment: 'node', - setupFiles: [path.resolve(__dirname, 'dotenv.js')], + setupFilesAfterEnv: [path.resolve(__dirname, 'dotenv.js')], testMatch: [ // '**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)' diff --git a/packages/plugin-collections/src/__tests__/actions/collections.test.ts b/packages/plugin-collections/src/__tests__/actions/collections.test.ts index 8fad54c30..575f13aff 100644 --- a/packages/plugin-collections/src/__tests__/actions/collections.test.ts +++ b/packages/plugin-collections/src/__tests__/actions/collections.test.ts @@ -1,7 +1,7 @@ import { Agent, getAgent, getApp } from '..'; import { Application } from '@nocobase/server'; import { types } from '../../interfaces'; -jest.setTimeout(30000); + describe('collection hooks', () => { let app: Application; let agent: Agent; diff --git a/packages/plugin-collections/src/__tests__/models/collection.test.ts b/packages/plugin-collections/src/__tests__/models/collection.test.ts index 92296a18b..55a69a061 100644 --- a/packages/plugin-collections/src/__tests__/models/collection.test.ts +++ b/packages/plugin-collections/src/__tests__/models/collection.test.ts @@ -1,7 +1,7 @@ import { Agent, getAgent, getApp } from '../'; import { Application } from '@nocobase/server'; import * as types from '../../interfaces/types'; -jest.setTimeout(30000); + describe('models.collection', () => { let app: Application; let agent: Agent; diff --git a/packages/plugin-collections/src/__tests__/models/field.test.ts b/packages/plugin-collections/src/__tests__/models/field.test.ts index 282315551..606b1500f 100644 --- a/packages/plugin-collections/src/__tests__/models/field.test.ts +++ b/packages/plugin-collections/src/__tests__/models/field.test.ts @@ -1,8 +1,8 @@ import { Agent, getAgent, getApp } from '../'; import { Application } from '@nocobase/server'; import { options, types } from '../../interfaces'; -jest.setTimeout(30000); import { FieldModel } from '../../models'; + describe('models.field', () => { let app: Application; let agent: Agent; diff --git a/packages/plugin-file-manager/src/__tests__/action.test.ts b/packages/plugin-file-manager/src/__tests__/action.test.ts index ccc1c48d2..181c16492 100644 --- a/packages/plugin-file-manager/src/__tests__/action.test.ts +++ b/packages/plugin-file-manager/src/__tests__/action.test.ts @@ -5,7 +5,7 @@ import { FILE_FIELD_NAME, STORAGE_TYPE_LOCAL } from '../constants'; import { getApp, getAgent, getAPI } from '.'; const DEFAULT_LOCAL_BASE_URL = process.env.LOCAL_STORAGE_BASE_URL || `http://localhost:${process.env.HTTP_PORT}/uploads`; -jest.setTimeout(30000); + describe('action', () => { let app; let agent;