Skip to content

Commit 8b9205d

Browse files
committed
[INTERNAL] static translator: Fix tests on Windows
1 parent 1352ffc commit 8b9205d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/lib/translators/static.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ test("Error: Throws if projectDependencies.yaml was not found", async (t) => {
1818
const fsStub = sinon.stub(fs, "readFile");
1919
fsStub.callsArgWith(1, fsError);
2020
const error = await t.throwsAsync(staticTranslator.generateDependencyTree(projectPath));
21+
const escapedYamlPath = path.join(projectPath, "projectDependencies.yaml")
22+
.replace("\\", "\\\\")
23+
.replace("/", "\\/")
24+
.replace(".", "\\.");
2125
t.regex(error.message,
22-
new RegExp("\\[static translator\\] Failed to load dependency tree from path " +
23-
"notExistingPath\\/projectDependencies\\.yaml - Error: ENOENT:"));
26+
new RegExp(`\\[static translator\\] Failed to load dependency tree from path ` +
27+
`${escapedYamlPath} - Error: ENOENT:`));
2428
fsStub.restore();
2529
});
2630

0 commit comments

Comments
 (0)