@nocobase/test 1.0.0-alpha.14 → 1.0.0-alpha.16

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/vitest.mjs +18 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/test",
3
- "version": "1.0.0-alpha.14",
3
+ "version": "1.0.0-alpha.16",
4
4
  "main": "lib/index.js",
5
5
  "module": "./src/index.ts",
6
6
  "types": "./lib/index.d.ts",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@faker-js/faker": "8.1.0",
54
- "@nocobase/server": "1.0.0-alpha.14",
54
+ "@nocobase/server": "1.0.0-alpha.16",
55
55
  "@playwright/test": "^1.44.0",
56
56
  "@testing-library/jest-dom": "^6.4.2",
57
57
  "@testing-library/react": "^14.0.0",
@@ -76,5 +76,5 @@
76
76
  "vitest-dom": "^0.1.1",
77
77
  "ws": "^8.13.0"
78
78
  },
79
- "gitHead": "829078819e5b9720a4c2501c340a301315c0d029"
79
+ "gitHead": "2a80f1804e0f0972d40e1a201310b192914849d0"
80
80
  }
package/vitest.mjs CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  import react from '@vitejs/plugin-react';
4
4
  import fs from 'fs';
5
- import path, { resolve } from 'path';
6
- import { URL } from 'url';
7
- import { defineConfig as vitestConfig, mergeConfig } from 'vitest/config';
5
+ import path, { dirname, resolve } from 'path';
6
+ import { fileURLToPath } from 'url';
7
+ import { mergeConfig, defineConfig as vitestConfig } from 'vitest/config';
8
8
 
9
- const CORE_CLIENT_PACKAGES = ['sdk', 'client'];
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
10
11
 
11
- const __dirname = new URL('.', import.meta.url).pathname;
12
+ const CORE_CLIENT_PACKAGES = ['sdk', 'client'];
12
13
 
13
14
  const relativePathToAbsolute = (relativePath) => {
14
15
  return path.resolve(process.cwd(), relativePath);
@@ -116,6 +117,7 @@ const defineServerConfig = () => {
116
117
  test: {
117
118
  setupFiles: resolve(__dirname, './setup/server.ts'),
118
119
  exclude: getExclude(true),
120
+ retry: 2,
119
121
  },
120
122
  coverage: {
121
123
  exclude: getExclude(true),
@@ -149,24 +151,21 @@ const defineClientConfig = () => {
149
151
  };
150
152
 
151
153
  export const getFilterInclude = (isServer, isCoverage) => {
152
- let argv = process.argv
153
- .slice(2);
154
+ let argv = process.argv.slice(2);
154
155
 
155
- argv = argv
156
- .filter((item, index) => {
157
- if (!item.startsWith('-')) {
158
- const pre = argv[index - 1];
156
+ argv = argv.filter((item, index) => {
157
+ if (!item.startsWith('-')) {
158
+ const pre = argv[index - 1];
159
159
 
160
- if (pre && pre.startsWith('--') && ['--reporter'].includes(pre)) {
161
- return false;
162
- }
163
-
164
- return true;
160
+ if (pre && pre.startsWith('--') && ['--reporter'].includes(pre)) {
161
+ return false;
165
162
  }
166
163
 
167
- return false;
168
- });
164
+ return true;
165
+ }
169
166
 
167
+ return false;
168
+ });
170
169
 
171
170
  let filterFileOrDir = argv[0];
172
171
 
@@ -257,7 +256,7 @@ export const defineConfig = () => {
257
256
  }
258
257
 
259
258
  const { include: coverageInclude } = getFilterInclude(isServer, true);
260
-
259
+
261
260
  if (coverageInclude) {
262
261
  config.test.coverage.include = coverageInclude;
263
262
  }
@@ -267,6 +266,5 @@ export const defineConfig = () => {
267
266
  config.test.coverage.reportsDirectory = reportsDirectory;
268
267
  }
269
268
 
270
-
271
269
  return config;
272
270
  };