@entreprise-os/vitest-config 0.0.1

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 (4) hide show
  1. package/app.ts +18 -0
  2. package/data.ts +22 -0
  3. package/package.json +21 -0
  4. package/ui.ts +25 -0
package/app.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { defineConfig } from "vitest/config";
2
+ import path from "path";
3
+
4
+ /**
5
+ * Base Vitest configuration for APP packages
6
+ *
7
+ * Provides path alias resolution for the package's src directory.
8
+ * Individual packages can extend this config and customize the alias name.
9
+ */
10
+ export function createAppConfig(aliasName: string, srcPath: string = "./src") {
11
+ return defineConfig({
12
+ resolve: {
13
+ alias: {
14
+ [aliasName]: path.resolve(process.cwd(), srcPath),
15
+ },
16
+ },
17
+ });
18
+ }
package/data.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ /**
4
+ * Base Vitest configuration for DATA packages
5
+ *
6
+ * Configures sequential test execution to avoid database race conditions.
7
+ * Each test file runs in its own process with tests running sequentially.
8
+ */
9
+ export default defineConfig({
10
+ test: {
11
+ // Run tests sequentially to avoid database race conditions
12
+ // Each test file runs in its own process, but tests within a file run sequentially
13
+ pool: "forks",
14
+ poolOptions: {
15
+ forks: {
16
+ singleFork: true,
17
+ },
18
+ },
19
+ // Global hook timeout for setup/teardown operations
20
+ hookTimeout: 100000,
21
+ },
22
+ });
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@entreprise-os/vitest-config",
3
+ "version": "0.0.1",
4
+ "description": "Shared Vitest configuration for Enterprise OS packages",
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "exports": {
10
+ "./app": "./app.ts",
11
+ "./data": "./data.ts",
12
+ "./ui": "./ui.ts"
13
+ },
14
+ "peerDependencies": {
15
+ "vitest": "^3.2.4"
16
+ },
17
+ "devDependencies": {
18
+ "@types/node": "^24.3.0",
19
+ "vitest": "^3.2.4"
20
+ }
21
+ }
package/ui.ts ADDED
@@ -0,0 +1,25 @@
1
+ import { defineConfig } from "vitest/config";
2
+ import path from "path";
3
+
4
+ /**
5
+ * Base Vitest configuration for UI packages
6
+ *
7
+ * Provides path alias resolution and test file patterns.
8
+ * Individual packages can extend this config and customize the alias name.
9
+ */
10
+ export function createUiConfig(
11
+ aliasName: string = "@",
12
+ srcPath: string = "src"
13
+ ) {
14
+ return defineConfig({
15
+ resolve: {
16
+ alias: {
17
+ [aliasName]: path.resolve(process.cwd(), srcPath),
18
+ },
19
+ },
20
+ test: {
21
+ include: ["**/__tests__/**/*.test.{ts,tsx,js,jsx}"],
22
+ exclude: ["**/*.stories.*", "**/*.mdx", "**/dist/**"],
23
+ },
24
+ });
25
+ }