@tachybase/test 1.6.3-alpha.2 → 1.6.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/test",
3
- "version": "1.6.3-alpha.2",
3
+ "version": "1.6.3",
4
4
  "license": "Apache-2.0",
5
5
  "exports": {
6
6
  ".": {
@@ -64,9 +64,9 @@
64
64
  "vite": "^7.1.10",
65
65
  "vitest": "^3.2.4",
66
66
  "ws": "^8.18.3",
67
- "@tachybase/globals": "1.6.3-alpha.2",
68
- "@tachybase/schema": "1.6.3-alpha.2",
69
- "@tego/core": "1.6.3-alpha.2",
70
- "@tachybase/database": "1.6.3-alpha.2"
67
+ "@tachybase/database": "1.6.3",
68
+ "@tachybase/globals": "1.6.3",
69
+ "@tachybase/schema": "1.6.3",
70
+ "@tego/core": "1.6.3"
71
71
  }
72
72
  }
package/setup/server.ts CHANGED
@@ -6,6 +6,9 @@ import { initEnv } from '@tego/devkit';
6
6
  import settings from './settings.sqlite';
7
7
 
8
8
  TachybaseGlobal.settings = settings;
9
+ // Initialize PLUGIN_PATHS for test environment with an empty array
10
+ // This prevents "pluginPaths is not iterable" errors when tests don't need actual plugin resolution
11
+ TachybaseGlobal.getInstance().set('PLUGIN_PATHS', []);
9
12
  // process.env.DB_TEST_DISTRIBUTOR_PORT = '23450';
10
13
  // process.env.DB_TEST_PREFIX = 'test';
11
14
  process.env.TEGO_RUNTIME_HOME = path.join(os.tmpdir(), 'test-sqlite');
@@ -1,11 +1,29 @@
1
+ const path = require('node:path');
2
+ const os = require('node:os');
1
3
  const defaultSettings = require('../../tego/presets/settings');
2
4
 
5
+ // Generate a unique database name for each test run to avoid data leakage between tests
6
+ const testDbName = `test-${Date.now()}-${Math.random().toString(36).slice(2)}.sqlite`;
7
+
3
8
  /** @type {import('@tachybase/globals').Settings} */
4
9
  module.exports = {
5
10
  ...defaultSettings,
6
11
 
12
+ // Override environment settings for tests
13
+ env: {
14
+ ...defaultSettings.env,
15
+ APP_ENV: 'test', // Use 'test' instead of 'development' to avoid throwing errors in plugin resolution
16
+ },
17
+
7
18
  logger: {
8
19
  ...defaultSettings.logger,
9
20
  level: 'error',
10
21
  },
22
+
23
+ database: {
24
+ ...defaultSettings.database,
25
+ // Use a unique file-based SQLite database in temp directory for each test run
26
+ // This allows data persistence across app.reload() calls while avoiding data leakage between test files
27
+ storage: path.join(os.tmpdir(), 'tego-test', testDbName),
28
+ },
11
29
  };