Skip to content

Commit

Permalink
tests fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
libetl committed Jun 20, 2023
1 parent b38ebc5 commit c63a94a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/mocks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const Server = class {
export const argv = ["test-runner", "local-traffic"];
export const cwd = mock.fn(() => "/home/user/fake-dir");
export const exit = mock.fn(() => {})
export const homedir = mock.fn(() => "/home/user")
export const createServer = mock.fn(
requestListener => new Server(requestListener),
);
Expand Down
4 changes: 2 additions & 2 deletions test/tests.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ const localTraffic = await (async () => {
}).outputText;
const javascriptWithMocks = javascript
.replace(
/from "(http|http2|https|fs|process)"/g,
/from "(http|http2|https|fs|os|process)"/g,
`from "${dirname(import.meta.url)}/mocks.mjs"`,
)
.replace("3000", "3");
.replace(/3000/g, "3");
const base64Module = `data:text/javascript;base64,${Buffer.from(
javascriptWithMocks,
).toString("base64url")}`;
Expand Down

0 comments on commit c63a94a

Please sign in to comment.