|
1 | 1 | // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. |
2 | 2 |
|
3 | 3 | import { describe, it, expect, beforeAll, afterAll } from 'vitest'; |
4 | | -import { mkdtempSync, writeFileSync, rmSync } from 'node:fs'; |
| 4 | +import { mkdirSync, mkdtempSync, writeFileSync, rmSync, symlinkSync } from 'node:fs'; |
| 5 | +import { createRequire } from 'node:module'; |
5 | 6 | import { tmpdir } from 'node:os'; |
6 | | -import { join } from 'node:path'; |
| 7 | +import { dirname, join } from 'node:path'; |
7 | 8 | import { bootSchemaStack } from './schema-migrate.js'; |
8 | | -import { linkSpec } from '../../test/helpers/define-stack-fixture.js'; |
9 | 9 |
|
10 | 10 | /** |
11 | 11 | * #21732 — `os migrate plan` / `apply` boot a config whose plugins hard-depend |
@@ -141,7 +141,12 @@ describe('os migrate plan/apply resolve a provider a PACKAGE requires (#22288)', |
141 | 141 | '', |
142 | 142 | ].join('\n'), |
143 | 143 | ); |
144 | | - linkSpec(dir); |
| 144 | + // The config imports `@objectstack/spec` from its own directory; link the |
| 145 | + // workspace package there (`test/helpers/define-stack-fixture.ts` does the |
| 146 | + // same, out of reach of this `src` program's `rootDir`). |
| 147 | + const specRoot = dirname(createRequire(import.meta.url).resolve('@objectstack/spec/package.json')); |
| 148 | + mkdirSync(join(dir, 'node_modules', '@objectstack'), { recursive: true }); |
| 149 | + symlinkSync(specRoot, join(dir, 'node_modules', '@objectstack', 'spec'), 'dir'); |
145 | 150 | savedEnv.OS_ARTIFACT_PATH = process.env.OS_ARTIFACT_PATH; |
146 | 151 | process.env.OS_ARTIFACT_PATH = join(dir, 'dist', 'objectstack.json'); |
147 | 152 | }); |
|
0 commit comments