Skip to content

test: extract shared vitest base config to de-duplicate n8n-workflow alias (#7) - #10

Merged
MihaelaAghirculesei merged 2 commits into
MihaelaAghirculesei:mainfrom
amasen02:fix/shared-vitest-base-config-7
Sep 4, 2026
Merged

MihaelaAghirculesei merged 2 commits into
MihaelaAghirculesei:mainfrom
amasen02:fix/shared-vitest-base-config-7

Conversation

@amasen02

@amasen02 amasen02 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #7 — extracts a shared base Vitest configuration at the repository root (vitest.config.base.ts) to centralize and de-duplicate the n8n-workflow alias configuration across packages.

Context

The CommonJS fixture node (n8n-nodes-probe-example) requires n8n-workflow, while ESM test suites import the ESM build of the package, causing multiple class instances across the boundary (breaking instanceof). Centralizing the CJS pin into vitest.config.base.ts ensures all packages share this configuration without duplication.

Changes

  1. Created vitest.config.base.ts at repository root defining baseConfig with the n8n-workflow CJS resolution alias and documentation.
  2. Refactored packages/unit/vitest.config.ts, packages/core/vitest.config.ts, packages/e2e/vitest.config.ts, packages/mock-http/vitest.config.ts, packages/otel/vitest.config.ts, and packages/metrics/vitest.config.ts to extend baseConfig via mergeConfig.
  3. Kept local coverage and environment configurations intact in each package config.

Verification

  • npx pnpm typecheck: 9/9 tasks passed cleanly with 0 type errors.
  • npx pnpm test: 14/14 tasks passed cleanly (100% test pass across packages).
  • npx pnpm lint: 9/9 tasks passed cleanly.

Checklist

  • Shared vitest.config.base.ts added at root
  • All packages merged with baseConfig
  • Tests, lint, and typecheck pass cleanly
  • Staged as Draft PR

…alias (MihaelaAghirculesei#7)

- Create vitest.config.base.ts at repository root defining shared resolve.alias for n8n-workflow
- Extend baseConfig via mergeConfig across packages/unit, packages/core, packages/mock-http, packages/e2e, packages/otel, and packages/metrics
- Preserve local package test environments and coverage settings
@amasen02
amasen02 force-pushed the fix/shared-vitest-base-config-7 branch from 80b2259 to a926ec0 Compare September 3, 2026 16:41
@amasen02
amasen02 marked this pull request as ready for review September 4, 2026 02:40
`mergeConfig` + the shared base config work without switching the root
package.json to ESM (`pnpm build/lint/typecheck/test` all green without it), and
that switch could change how root-level tooling loads. Also strip the UTF-8 BOM
that crept into `vitest.config.base.ts` so it matches the other config files.
@MihaelaAghirculesei

Copy link
Copy Markdown
Owner

Thanks for picking this up — the mergeConfig + root vitest.config.base.ts approach is exactly what #7 was after, and it's cleanly applied across all six packages.

I pushed one small fixup commit (6d1737a) since maintainer edits are enabled:

  • Dropped "type": "module" from the root package.json. The shared base config and mergeConfig work without it — pnpm build / lint / typecheck / test are all green with it removed — and flipping the workspace root to ESM can quietly change how root-level tooling resolves modules, so I'd rather not carry that here.
  • Stripped a UTF-8 BOM that had crept into the first line of vitest.config.base.ts, so it matches the other config files.

Local run on the branch: build 7/7, lint 9/9, typecheck 9/9, test 14/14, prettier --check clean. CI needs a maintainer approval to run on the fork PR — doing that now.

Nice first contribution, and it lands right before it was needed: the e2e package (Milestone 4) will rely on this same alias.

@MihaelaAghirculesei
MihaelaAghirculesei merged commit 3dc6b93 into MihaelaAghirculesei:main Sep 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract a shared Vitest config to de-duplicate the n8n-workflow alias

2 participants