mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 11:12:20 +08:00
Merge branch 'next' into develop
This commit is contained in:
commit
c755407ad7
@ -15,6 +15,9 @@ import qs from 'qs';
|
|||||||
import supertest, { SuperAgentTest } from 'supertest';
|
import supertest, { SuperAgentTest } from 'supertest';
|
||||||
import { MemoryPubSubAdapter } from './memory-pub-sub-adapter';
|
import { MemoryPubSubAdapter } from './memory-pub-sub-adapter';
|
||||||
import { MockDataSource } from './mock-data-source';
|
import { MockDataSource } from './mock-data-source';
|
||||||
|
import path from 'path';
|
||||||
|
import process from 'node:process';
|
||||||
|
import { promises as fs } from 'fs';
|
||||||
|
|
||||||
interface ActionParams {
|
interface ActionParams {
|
||||||
filterByTk?: any;
|
filterByTk?: any;
|
||||||
@ -329,6 +332,14 @@ export async function createMockCluster({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function createMockServer(options: MockServerOptions = {}): Promise<MockServer> {
|
export async function createMockServer(options: MockServerOptions = {}): Promise<MockServer> {
|
||||||
|
// clean cache directory
|
||||||
|
const cachePath = path.join(process.cwd(), 'storage', 'cache');
|
||||||
|
try {
|
||||||
|
await fs.rm(cachePath, { recursive: true, force: true });
|
||||||
|
await fs.mkdir(cachePath, { recursive: true });
|
||||||
|
} catch (e) {
|
||||||
|
// ignore errors
|
||||||
|
}
|
||||||
const { version, beforeInstall, skipInstall, skipStart, ...others } = options;
|
const { version, beforeInstall, skipInstall, skipStart, ...others } = options;
|
||||||
const app: MockServer = mockServer(others);
|
const app: MockServer = mockServer(others);
|
||||||
if (!skipInstall) {
|
if (!skipInstall) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user