@altafusion/test-kit 0.3.0 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @altafusion/test-kit
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 46f552d: Ship compiled JavaScript and type declarations. The 0.3.x tarballs exposed raw `.ts` entry points, which Node cannot load from `node_modules` (`ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING`), so `eslint.config.mjs`, Playwright and Vitest configs that import these packages failed outside the workspace. The source stays TypeScript in the repo; `publishConfig` points the packed manifest at `dist/`.
8
+
9
+ ## 0.3.1
10
+
11
+ No changes in this release.
12
+
3
13
  ## 0.3.0
4
14
 
5
15
  No changes in this release.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @altafusion/test-kit — Test kit (Vitest, Nuxt test utils, MSW)
3
+ *
4
+ * Centralized Vitest, Nuxt test utils, MSW setup.
5
+ * Pattern inspired by UnoCSS.
6
+ *
7
+ * @example
8
+ * import { baseTestConfig } from '@altafusion/test-kit'
9
+ * import { defineVitestProject } from '@altafusion/test-kit/nuxt'
10
+ * See README.md for full usage examples.
11
+ */
12
+ export { baseTestConfig, sharedVitestConfig } from '@altafusion/test-kit/vitest';
13
+ export { defineVueAppVitestConfig } from './vitest-app.ts';
14
+ export type { UserWorkspaceConfig } from 'vitest/config';
@@ -9,7 +9,5 @@
9
9
  * import { defineVitestProject } from '@altafusion/test-kit/nuxt'
10
10
  * See README.md for full usage examples.
11
11
  */
12
-
13
- export { baseTestConfig, sharedVitestConfig } from '@altafusion/test-kit/vitest'
14
- export { defineVueAppVitestConfig } from './vitest-app.ts'
15
- export type { UserWorkspaceConfig } from 'vitest/config'
12
+ export { baseTestConfig, sharedVitestConfig } from '@altafusion/test-kit/vitest';
13
+ export { defineVueAppVitestConfig } from "./vitest-app.js";
@@ -4,5 +4,4 @@
4
4
  * Re-exports defineVitestProject from @nuxt/test-utils/config for Nuxt runtime tests.
5
5
  * Use in root vitest.config.ts to add a Nuxt project.
6
6
  */
7
-
8
- export { defineVitestProject, defineVitestConfig } from '@nuxt/test-utils/config'
7
+ export { defineVitestProject, defineVitestConfig } from '@nuxt/test-utils/config';
package/dist/nuxt.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @altafusion/test-kit — Nuxt test utils integration
3
+ *
4
+ * Re-exports defineVitestProject from @nuxt/test-utils/config for Nuxt runtime tests.
5
+ * Use in root vitest.config.ts to add a Nuxt project.
6
+ */
7
+ export { defineVitestProject, defineVitestConfig } from '@nuxt/test-utils/config';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @altafusion/test-kit — Playwright preset for repo-root E2E (Chromium + WebKit).
3
+ */
4
+ import { defineConfig, devices, type PlaywrightTestConfig } from '@playwright/test';
5
+ /** Must end with `/` so relative `page.goto('./')` resolves against the app origin. */
6
+ export declare const defaultPlaywrightBaseURL: string;
7
+ /**
8
+ * Shared Playwright defaults for Altafusion packages.
9
+ * Pass `webServer`, `testDir` overrides, etc. from the repo-root config.
10
+ */
11
+ export declare function defineFrontendPlaywrightConfig(overrides?: PlaywrightTestConfig): ReturnType<typeof defineConfig>;
12
+ export { defineConfig, devices };
13
+ export type { PlaywrightTestConfig } from '@playwright/test';
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @altafusion/test-kit — Playwright preset for repo-root E2E (Chromium + WebKit).
3
+ */
4
+ import { defineConfig, devices } from '@playwright/test';
5
+ /** Must end with `/` so relative `page.goto('./')` resolves against the app origin. */
6
+ export const defaultPlaywrightBaseURL = `${(process.env.PLAYWRIGHT_BASE_URL ?? 'http://127.0.0.1:8001').replace(/\/?$/, '/')}`;
7
+ const defaultProjects = [
8
+ {
9
+ name: 'chromium',
10
+ use: { ...devices['Desktop Chrome'] },
11
+ },
12
+ {
13
+ name: 'webkit',
14
+ use: { ...devices['Desktop Safari'] },
15
+ },
16
+ ];
17
+ const defaultUse = {
18
+ baseURL: defaultPlaywrightBaseURL,
19
+ ignoreHTTPSErrors: true,
20
+ trace: 'on-first-retry',
21
+ screenshot: 'only-on-failure',
22
+ };
23
+ /**
24
+ * Shared Playwright defaults for Altafusion packages.
25
+ * Pass `webServer`, `testDir` overrides, etc. from the repo-root config.
26
+ */
27
+ export function defineFrontendPlaywrightConfig(overrides = {}) {
28
+ const baseURL = overrides.use?.baseURL ?? defaultPlaywrightBaseURL;
29
+ return defineConfig({
30
+ testDir: 'e2e',
31
+ fullyParallel: true,
32
+ forbidOnly: !!process.env.CI,
33
+ retries: process.env.CI ? 2 : 0,
34
+ reporter: [
35
+ ['list'],
36
+ ['html', { open: 'never', outputFolder: 'playwright-report' }],
37
+ ],
38
+ ...overrides,
39
+ use: {
40
+ ...defaultUse,
41
+ ...overrides.use,
42
+ baseURL,
43
+ },
44
+ projects: overrides.projects ?? defaultProjects,
45
+ });
46
+ }
47
+ export { defineConfig, devices };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Default Vitest preset for Nuxt/Vue apps — happy-dom + Vue plugin + base defaults.
3
+ * Keeps per-app vitest.config.ts to a single import (root projects stay in sync via same defaults).
4
+ */
5
+ import { defineConfig, type UserWorkspaceConfig } from 'vitest/config';
6
+ export declare function defineVueAppVitestConfig(testOverrides?: UserWorkspaceConfig['test']): ReturnType<typeof defineConfig>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Default Vitest preset for Nuxt/Vue apps — happy-dom + Vue plugin + base defaults.
3
+ * Keeps per-app vitest.config.ts to a single import (root projects stay in sync via same defaults).
4
+ */
5
+ import vue from '@vitejs/plugin-vue';
6
+ import { defineConfig, mergeConfig } from 'vitest/config';
7
+ import { baseTestConfig } from '@altafusion/test-kit/vitest';
8
+ export function defineVueAppVitestConfig(testOverrides) {
9
+ return defineConfig(mergeConfig({
10
+ plugins: [vue()],
11
+ test: {
12
+ ...baseTestConfig,
13
+ include: ['**/*.{test,spec}.{ts,tsx}'],
14
+ environment: 'happy-dom',
15
+ passWithNoTests: true,
16
+ },
17
+ }, testOverrides ? { test: testOverrides } : {}));
18
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @altafusion/test-kit — Base Vitest configuration
3
+ *
4
+ * Centralized test config similar to UnoCSS patterns.
5
+ * Consumers extend this via merge or createVitestConfig().
6
+ */
7
+ /**
8
+ * Base test config — globals, env, coverage, default environment.
9
+ * Merge this into your vitest config or use createVitestConfig().
10
+ */
11
+ export declare const baseTestConfig: {
12
+ globals: boolean;
13
+ env: {
14
+ NODE_ENV: string;
15
+ };
16
+ testTimeout: number;
17
+ hookTimeout: number;
18
+ environment: string;
19
+ include: string[];
20
+ exclude: string[];
21
+ coverage: {
22
+ provider: "v8";
23
+ reporter: string[];
24
+ reportsDirectory: string;
25
+ include: string[];
26
+ exclude: string[];
27
+ };
28
+ };
29
+ /**
30
+ * Define config that extends the base.
31
+ * Use for packages that don't need the Nuxt environment.
32
+ */
33
+ export declare const sharedVitestConfig: import("vite").UserConfig;
34
+ export default sharedVitestConfig;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @altafusion/test-kit — Base Vitest configuration
3
+ *
4
+ * Centralized test config similar to UnoCSS patterns.
5
+ * Consumers extend this via merge or createVitestConfig().
6
+ */
7
+ import { configDefaults, defineConfig } from 'vitest/config';
8
+ /**
9
+ * Base test config — globals, env, coverage, default environment.
10
+ * Merge this into your vitest config or use createVitestConfig().
11
+ */
12
+ export const baseTestConfig = {
13
+ globals: true,
14
+ env: {
15
+ NODE_ENV: 'test',
16
+ },
17
+ testTimeout: 10_000,
18
+ hookTimeout: 10_000,
19
+ environment: 'happy-dom',
20
+ include: ['**/*.{test,spec}.{ts,tsx,js,jsx}'],
21
+ exclude: [
22
+ ...configDefaults.exclude,
23
+ '**/node_modules/**',
24
+ '**/dist/**',
25
+ '**/.nuxt/**',
26
+ '**/.output/**',
27
+ '**/coverage/**',
28
+ ],
29
+ coverage: {
30
+ provider: 'v8',
31
+ reporter: ['text', 'json', 'html'],
32
+ reportsDirectory: './coverage',
33
+ include: ['**/*.{ts,tsx,js,jsx}'],
34
+ exclude: [
35
+ ...configDefaults.exclude,
36
+ '**/node_modules/**',
37
+ '**/dist/**',
38
+ '**/.nuxt/**',
39
+ '**/.output/**',
40
+ '**/coverage/**',
41
+ '**/*.d.ts',
42
+ '**/*.{test,spec}.{ts,tsx,js,jsx}',
43
+ '**/test/**',
44
+ '**/__tests__/**',
45
+ '**/*.config.*',
46
+ ],
47
+ },
48
+ };
49
+ /**
50
+ * Define config that extends the base.
51
+ * Use for packages that don't need the Nuxt environment.
52
+ */
53
+ export const sharedVitestConfig = defineConfig({
54
+ test: baseTestConfig,
55
+ });
56
+ export default sharedVitestConfig;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@altafusion/test-kit",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.2",
5
5
  "description": "Test kit for Altafusion packages — Vitest, Nuxt test utils, MSW",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/altafusion/fugue/tree/main/packages-platform/test-kit#readme",
@@ -16,13 +16,28 @@
16
16
  "publishConfig": {
17
17
  "access": "public"
18
18
  },
19
- "main": "./index.ts",
19
+ "main": "./dist/index.js",
20
20
  "exports": {
21
- ".": "./index.ts",
22
- "./vitest": "./vitest.config.base.ts",
23
- "./vitest-app": "./vitest-app.ts",
24
- "./nuxt": "./nuxt.ts",
25
- "./playwright": "./playwright.ts"
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ },
25
+ "./vitest": {
26
+ "types": "./dist/vitest.config.base.d.ts",
27
+ "default": "./dist/vitest.config.base.js"
28
+ },
29
+ "./vitest-app": {
30
+ "types": "./dist/vitest-app.d.ts",
31
+ "default": "./dist/vitest-app.js"
32
+ },
33
+ "./nuxt": {
34
+ "types": "./dist/nuxt.d.ts",
35
+ "default": "./dist/nuxt.js"
36
+ },
37
+ "./playwright": {
38
+ "types": "./dist/playwright.d.ts",
39
+ "default": "./dist/playwright.js"
40
+ }
26
41
  },
27
42
  "peerDependencies": {
28
43
  "@nuxt/test-utils": ">=4.0.0"
@@ -39,26 +54,27 @@
39
54
  },
40
55
  "devDependencies": {
41
56
  "@nuxt/test-utils": "^4.4.0",
57
+ "@types/node": "^26.6.6",
42
58
  "@vitest/coverage-v8": "^5.1.1",
43
59
  "@vitest/ui": "^5.1.1",
44
60
  "@vue/test-utils": "^2.6.0",
45
61
  "happy-dom": "^21.0.4",
46
62
  "msw": "^3.0.7",
63
+ "typescript": "^6.0.3",
47
64
  "vue": "^3.5.46"
48
65
  },
49
66
  "files": [
50
- "**",
51
- "!**/*.test.ts",
52
- "!**/.nuxt",
53
- "!**/.output",
54
- "!**/.data",
55
- "!**/coverage",
56
- "!**/node_modules"
67
+ "dist",
68
+ "README.md",
69
+ "LICENSE",
70
+ "CHANGELOG.md"
57
71
  ],
58
72
  "scripts": {
59
73
  "test": "pnpm --dir ../.. exec vitest run --project test-kit",
60
74
  "test:watch": "pnpm --dir ../.. exec vitest --project test-kit",
61
75
  "test:ui": "pnpm --dir ../.. exec vitest --ui --project test-kit",
62
- "test:coverage": "pnpm --dir ../.. exec vitest run --coverage --project test-kit"
63
- }
76
+ "test:coverage": "pnpm --dir ../.. exec vitest run --coverage --project test-kit",
77
+ "build": "tsc -p tsconfig.build.json"
78
+ },
79
+ "types": "./dist/index.d.ts"
64
80
  }
package/playwright.ts DELETED
@@ -1,59 +0,0 @@
1
- /**
2
- * @altafusion/test-kit — Playwright preset for repo-root E2E (Chromium + WebKit).
3
- */
4
-
5
- import { defineConfig, devices, type PlaywrightTestConfig } from '@playwright/test'
6
-
7
- /** Must end with `/` so relative `page.goto('./')` resolves against the app origin. */
8
- export const defaultPlaywrightBaseURL = `${(
9
- process.env.PLAYWRIGHT_BASE_URL ?? 'http://127.0.0.1:8001'
10
- ).replace(/\/?$/, '/')}`
11
-
12
- const defaultProjects: NonNullable<PlaywrightTestConfig['projects']> = [
13
- {
14
- name: 'chromium',
15
- use: { ...devices['Desktop Chrome'] },
16
- },
17
- {
18
- name: 'webkit',
19
- use: { ...devices['Desktop Safari'] },
20
- },
21
- ]
22
-
23
- const defaultUse: PlaywrightTestConfig['use'] = {
24
- baseURL: defaultPlaywrightBaseURL,
25
- ignoreHTTPSErrors: true,
26
- trace: 'on-first-retry',
27
- screenshot: 'only-on-failure',
28
- }
29
-
30
- /**
31
- * Shared Playwright defaults for Altafusion packages.
32
- * Pass `webServer`, `testDir` overrides, etc. from the repo-root config.
33
- */
34
- export function defineFrontendPlaywrightConfig(
35
- overrides: PlaywrightTestConfig = {},
36
- ): ReturnType<typeof defineConfig> {
37
- const baseURL = overrides.use?.baseURL ?? defaultPlaywrightBaseURL
38
-
39
- return defineConfig({
40
- testDir: 'e2e',
41
- fullyParallel: true,
42
- forbidOnly: !!process.env.CI,
43
- retries: process.env.CI ? 2 : 0,
44
- reporter: [
45
- ['list'],
46
- ['html', { open: 'never', outputFolder: 'playwright-report' }],
47
- ],
48
- ...overrides,
49
- use: {
50
- ...defaultUse,
51
- ...overrides.use,
52
- baseURL,
53
- },
54
- projects: overrides.projects ?? defaultProjects,
55
- })
56
- }
57
-
58
- export { defineConfig, devices }
59
- export type { PlaywrightTestConfig } from '@playwright/test'
package/vitest-app.ts DELETED
@@ -1,25 +0,0 @@
1
- /**
2
- * Default Vitest preset for Nuxt/Vue apps — happy-dom + Vue plugin + base defaults.
3
- * Keeps per-app vitest.config.ts to a single import (root projects stay in sync via same defaults).
4
- */
5
-
6
- import vue from '@vitejs/plugin-vue'
7
- import { defineConfig, mergeConfig, type UserWorkspaceConfig } from 'vitest/config'
8
- import { baseTestConfig } from '@altafusion/test-kit/vitest'
9
-
10
- export function defineVueAppVitestConfig(testOverrides?: UserWorkspaceConfig['test']): ReturnType<typeof defineConfig> {
11
- return defineConfig(
12
- mergeConfig(
13
- {
14
- plugins: [vue()],
15
- test: {
16
- ...baseTestConfig,
17
- include: ['**/*.{test,spec}.{ts,tsx}'],
18
- environment: 'happy-dom',
19
- passWithNoTests: true,
20
- },
21
- },
22
- testOverrides ? { test: testOverrides } : {},
23
- ),
24
- )
25
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * @altafusion/test-kit — Base Vitest configuration
3
- *
4
- * Centralized test config similar to UnoCSS patterns.
5
- * Consumers extend this via merge or createVitestConfig().
6
- */
7
-
8
- import { configDefaults, defineConfig } from 'vitest/config'
9
- import type { UserWorkspaceConfig } from 'vitest/config'
10
-
11
- /**
12
- * Base test config — globals, env, coverage, default environment.
13
- * Merge this into your vitest config or use createVitestConfig().
14
- */
15
- export const baseTestConfig = {
16
- globals: true,
17
- env: {
18
- NODE_ENV: 'test',
19
- },
20
- testTimeout: 10_000,
21
- hookTimeout: 10_000,
22
- environment: 'happy-dom',
23
- include: ['**/*.{test,spec}.{ts,tsx,js,jsx}'],
24
- exclude: [
25
- ...configDefaults.exclude,
26
- '**/node_modules/**',
27
- '**/dist/**',
28
- '**/.nuxt/**',
29
- '**/.output/**',
30
- '**/coverage/**',
31
- ],
32
- coverage: {
33
- provider: 'v8' as const,
34
- reporter: ['text', 'json', 'html'],
35
- reportsDirectory: './coverage',
36
- include: ['**/*.{ts,tsx,js,jsx}'],
37
- exclude: [
38
- ...configDefaults.exclude,
39
- '**/node_modules/**',
40
- '**/dist/**',
41
- '**/.nuxt/**',
42
- '**/.output/**',
43
- '**/coverage/**',
44
- '**/*.d.ts',
45
- '**/*.{test,spec}.{ts,tsx,js,jsx}',
46
- '**/test/**',
47
- '**/__tests__/**',
48
- '**/*.config.*',
49
- ],
50
- },
51
- }
52
-
53
- /**
54
- * Define config that extends the base.
55
- * Use for packages that don't need the Nuxt environment.
56
- */
57
- export const sharedVitestConfig = defineConfig({
58
- test: baseTestConfig,
59
- })
60
-
61
- export default sharedVitestConfig