Skip to content

Commit ea963f7

Browse files
test: launch model bundle fixture through Windows shim
1 parent d6bf548 commit ea963f7

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

global-template/docgen/test/model-bundle-pipeline.test.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,21 @@ import { projectPaths, readJson, writeJson } from '../lib/core.mjs';
99

1010
const testDir = path.dirname(fileURLToPath(import.meta.url));
1111

12+
function providerExecutable(paths) {
13+
const source = path.join(testDir, 'fixtures', 'model-bundle-provider.mjs');
14+
if (process.platform !== 'win32') return source;
15+
const dir = path.join(paths.base, 'test-bin'); fs.mkdirSync(dir, { recursive: true });
16+
const script = path.join(dir, 'model-bundle-provider.mjs'); fs.copyFileSync(source, script);
17+
const shim = path.join(dir, 'model-bundle-provider.cmd');
18+
fs.writeFileSync(shim, `@echo off\r\n"${process.execPath}" "${script}" %*\r\n`);
19+
return shim;
20+
}
21+
1222
function fixture({ missingPolicy = 'placeholder' } = {}) {
1323
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'docgen-bundle-')); const paths = projectPaths(root);
1424
fs.mkdirSync(path.join(root, 'src'), { recursive: true }); fs.writeFileSync(path.join(root, 'src', 'Resource.java'), 'class Resource {}\n');
1525
fs.mkdirSync(path.dirname(paths.config), { recursive: true });
16-
const provider = path.join(testDir, 'fixtures', 'model-bundle-provider.mjs');
26+
const provider = providerExecutable(paths);
1727
writeJson(paths.project, { schemaVersion: '2.0', kitVersion: '2.0.0' });
1828
writeJson(paths.config, {
1929
schemaVersion: '2.0', projectName: 'Bundle Fixture',

0 commit comments

Comments
 (0)