mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 20:53:00 +00:00
fix(verify): honor an explicit conformance source root (#11943)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
This commit is contained in:
1 parent
53977802b3
commit
c4f9ead498
2 files changed
+22
-4
No files matched your search
@@ -45,14 +45,13 @@ process.stdout.write(
|
||||
);
|
||||
|
||||
async function resolveSourceRoot(manifestPath, declaredSourceRoot) {
|
||||
if (declaredSourceRoot !== undefined)
|
||||
return realpath(resolve(process.cwd(), declaredSourceRoot));
|
||||
const candidates = [
|
||||
declaredSourceRoot === undefined
|
||||
? null
|
||||
: resolve(process.cwd(), declaredSourceRoot),
|
||||
resolve(process.cwd(), "tests/conformance"),
|
||||
resolve(dirname(dirname(dirname(manifestPath))), "tests/conformance"),
|
||||
resolve(dirname(manifestPath), "../../tests/conformance"),
|
||||
].filter((candidate) => candidate !== null);
|
||||
];
|
||||
for (const candidate of candidates) {
|
||||
try {
|
||||
return await realpath(candidate);
|
||||
|
||||
@@ -170,3 +170,22 @@ it("preserves a carriage return that belongs to an nm symbol name", () => {
|
||||
"rea_inventory_0000\r",
|
||||
]);
|
||||
});
|
||||
|
||||
it("refuses a missing explicit source root even when a default exists", async () => {
|
||||
const { commands, root } = await ownedFixture("rea-fixture-source-root-");
|
||||
await mkdir(join(root, "tests", "conformance"), { recursive: true });
|
||||
const manifest = join(root, "manifest.json");
|
||||
await writeFile(manifest, "{}");
|
||||
const selected = join(root, "selected-sources");
|
||||
await expect(
|
||||
commands.exec(process.execPath, [verifier, manifest, selected], {
|
||||
cwd: root,
|
||||
timeout: 10_000,
|
||||
}),
|
||||
).rejects.toMatchObject({
|
||||
code: 1,
|
||||
snapshot: {
|
||||
stderr: { text: expect.stringContaining(selected) },
|
||||
},
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user