mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-22 01:53:24 +01:00
Update snapshot for checkWorkingDirectory test
This commit is contained in:
parent
e5251df521
commit
105f191b19
2 changed files with 10 additions and 24 deletions
|
@ -47,18 +47,10 @@ describe("checkWorkingDirectory", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should fail if the directory does not exist", () => {
|
test("should fail if the directory does not exist", () => {
|
||||||
try {
|
expect(() =>
|
||||||
checkWorkingDirectory("/does/not/exist");
|
checkWorkingDirectory("/does/not/exist"),
|
||||||
} catch (error) {
|
).toThrowErrorMatchingInlineSnapshot(
|
||||||
expect(error.message).toMatchInlineSnapshot();
|
'"Directory /does/not/exist does not exist."',
|
||||||
}
|
);
|
||||||
});
|
|
||||||
|
|
||||||
test("should fail if an error occurs while checking/creating the directory", () => {
|
|
||||||
try {
|
|
||||||
checkWorkingDirectory("/does/not/exist");
|
|
||||||
} catch (error) {
|
|
||||||
expect(error.message).toMatchInlineSnapshot();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -113,18 +113,12 @@ async function runProcess(
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkWorkingDirectory(workingDirectory = ".") {
|
function checkWorkingDirectory(workingDirectory = ".") {
|
||||||
try {
|
|
||||||
const normalizedPath = path.normalize(workingDirectory);
|
const normalizedPath = path.normalize(workingDirectory);
|
||||||
if (existsSync(normalizedPath)) {
|
if (existsSync(normalizedPath)) {
|
||||||
return normalizedPath;
|
return normalizedPath;
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Directory ${workingDirectory} does not exist.`);
|
throw new Error(`Directory ${workingDirectory} does not exist.`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
throw new Error(
|
|
||||||
`While checking/creating directory ${workingDirectory} received ${error}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function installWrangler() {
|
function installWrangler() {
|
||||||
|
|
Loading…
Reference in a new issue