@nocobase/test 2.1.0-alpha.17 → 2.1.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,11 +7,9 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- var __create = Object.create;
11
10
  var __defProp = Object.defineProperty;
12
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
13
  var __hasOwnProp = Object.prototype.hasOwnProperty;
16
14
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
17
15
  var __export = (target, all) => {
@@ -26,21 +24,12 @@ var __copyProps = (to, from, except, desc) => {
26
24
  }
27
25
  return to;
28
26
  };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
28
  var mock_isolated_cluster_exports = {};
39
29
  __export(mock_isolated_cluster_exports, {
40
30
  MockIsolatedCluster: () => MockIsolatedCluster
41
31
  });
42
32
  module.exports = __toCommonJS(mock_isolated_cluster_exports);
43
- var import_node_path = __toESM(require("node:path"));
44
33
  var import_node_child_process = require("node:child_process");
45
34
  var import_portfinder = require("portfinder");
46
35
  var import_utils = require("@nocobase/utils");
@@ -69,8 +58,8 @@ const _MockIsolatedCluster = class _MockIsolatedCluster {
69
58
  ...this.options.env,
70
59
  APP_PORT: `${port}`,
71
60
  APPEND_PRESET_BUILT_IN_PLUGINS: (this.options.plugins ?? []).join(","),
72
- SOCKET_PATH: `storage/tests/gateway-cluster-${(0, import_utils.uid)()}.sock`,
73
- PM2_HOME: import_node_path.default.resolve(process.cwd(), `storage/tests/.pm2-${(0, import_utils.uid)()}`)
61
+ SOCKET_PATH: (0, import_utils.storagePathJoin)("tests", `gateway-cluster-${(0, import_utils.uid)()}.sock`),
62
+ PM2_HOME: (0, import_utils.storagePathJoin)("tests", `.pm2-${(0, import_utils.uid)()}`)
74
63
  }
75
64
  });
76
65
  await new Promise((resolve, reject) => {
@@ -53,8 +53,6 @@ var import_qs = __toESM(require("qs"));
53
53
  var import_supertest = __toESM(require("supertest"));
54
54
  var import_memory_pub_sub_adapter = require("./memory-pub-sub-adapter");
55
55
  var import_mock_data_source = require("./mock-data-source");
56
- var import_path = __toESM(require("path"));
57
- var import_node_process = __toESM(require("node:process"));
58
56
  var import_fs = require("fs");
59
57
  const _MockServer = class _MockServer extends import_server.Application {
60
58
  registerMockDataSource() {
@@ -264,7 +262,7 @@ async function createMockCluster({
264
262
  }
265
263
  __name(createMockCluster, "createMockCluster");
266
264
  async function createMockServer(options = {}) {
267
- const cachePath = import_path.default.join(import_node_process.default.cwd(), "storage", "cache");
265
+ const cachePath = (0, import_utils.storagePathJoin)("cache");
268
266
  try {
269
267
  await import_fs.promises.rm(cachePath, { recursive: true, force: true });
270
268
  await import_fs.promises.mkdir(cachePath, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/test",
3
- "version": "2.1.0-alpha.17",
3
+ "version": "2.1.0-alpha.19",
4
4
  "main": "lib/index.js",
5
5
  "module": "./src/index.ts",
6
6
  "types": "./lib/index.d.ts",
@@ -51,7 +51,8 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@faker-js/faker": "8.1.0",
54
- "@nocobase/server": "2.1.0-alpha.17",
54
+ "@nocobase/server": "2.1.0-alpha.19",
55
+ "@nocobase/utils": "2.1.0-alpha.19",
55
56
  "@playwright/test": "^1.45.3",
56
57
  "@testing-library/jest-dom": "^6.4.2",
57
58
  "@testing-library/react": "^14.0.0",
@@ -76,5 +77,5 @@
76
77
  "vitest-dom": "^0.1.1",
77
78
  "ws": "^8.13.0"
78
79
  },
79
- "gitHead": "586cb00f56557e66168b9720d0e0193a1b752067"
80
+ "gitHead": "3d13700360eac1c0f9dbf6a5f167ed396a294a3c"
80
81
  }
@@ -1,5 +1,6 @@
1
1
  import { createMockServer } from '@nocobase/test';
2
2
  import { CollectionRepository } from '@nocobase/plugin-data-source-main';
3
+ import { storagePathJoin } from '@nocobase/utils';
3
4
  import fs from 'fs';
4
5
  import path from 'path';
5
6
  import os from 'os';
@@ -7,7 +8,7 @@ import ExcelJS from 'exceljs';
7
8
  import { faker } from '@faker-js/faker';
8
9
  import request from 'superagent';
9
10
 
10
- const storagePath = path.resolve(process.cwd(), 'storage', 'perf', 'importDataTest');
11
+ const storagePath = storagePathJoin('perf', 'importDataTest');
11
12
 
12
13
  export default async function main() {
13
14
  const app = await createMockServer({