Skip to content

Commit 3f50f81

Browse files
committed
PR feedback
1 parent 5ec0f6d commit 3f50f81

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/diff/oasDiff.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ describe("oasDiffChangelog", () => {
123123
consoleErrorSpy.restore();
124124
});
125125
it("should return error code 2 when no exchange.json files are found", async () => {
126+
const consoleWarnSpy = sinon.spy(console, "warn");
126127
const execStub = createMockExec();
127128
const fsStub = createMockFs();
128129

@@ -142,8 +143,10 @@ describe("oasDiffChangelog", () => {
142143
expect(result).to.equal(2);
143144
expect(consoleErrorSpy.called).to.be.true;
144145
expect(consoleErrorSpy.args[0][0].message).to.include(
145-
"No exchange.json file found in leaf directory: base/api-v1"
146+
"No exchange.json files found in any directory under: base"
146147
);
148+
149+
consoleWarnSpy.restore();
147150
});
148151

149152
it("should return error code 2 when no exchange.json files are found in entire directory tree", async () => {
@@ -163,7 +166,7 @@ describe("oasDiffChangelog", () => {
163166
expect(result).to.equal(2);
164167
expect(consoleErrorSpy.called).to.be.true;
165168
expect(consoleErrorSpy.args[0][0].message).to.include(
166-
"No exchange.json file found in leaf directory: base. Each API directory must contain an exchange.json file."
169+
"No exchange.json files found in any directory under: base. Each API directory must contain an exchange.json file."
167170
);
168171
});
169172

src/diff/oasDiff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async function findExchangeDirectories(
115115
}
116116
// If this is a leaf directory and we haven't found exchange.json, that's an error
117117
if (subdirectories.length === 0 && !hasExchangeJson) {
118-
throw new Error(
118+
console.warn(
119119
`No exchange.json file found in leaf directory: ${currentPath}. Each API directory must contain an exchange.json file.`
120120
);
121121
}

0 commit comments

Comments
 (0)