mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 00:57:53 +02:00
misc(plugin-docs): fix Windows test snapshot for git history retrieval (#5905)
* misc(plugin-docs): fix test snapshot * Fix again
This commit is contained in:
parent
334b4397e7
commit
a835c9bc48
2 changed files with 5 additions and 3 deletions
|
@ -40,7 +40,7 @@ describe('lastUpdate', () => {
|
||||||
expect(await getFileLastUpdate(nonExistingFilePath)).toBeNull();
|
expect(await getFileLastUpdate(nonExistingFilePath)).toBeNull();
|
||||||
expect(consoleMock).toHaveBeenCalledTimes(1);
|
expect(consoleMock).toHaveBeenCalledTimes(1);
|
||||||
expect(consoleMock.mock.calls[0][0].message).toContain(
|
expect(consoleMock.mock.calls[0][0].message).toContain(
|
||||||
`fatal: ambiguous argument '${nonExistingFilePath}': unknown revision or path not in the working tree.`,
|
' with exit code 128',
|
||||||
);
|
);
|
||||||
expect(await getFileLastUpdate(null)).toBeNull();
|
expect(await getFileLastUpdate(null)).toBeNull();
|
||||||
expect(await getFileLastUpdate(undefined)).toBeNull();
|
expect(await getFileLastUpdate(undefined)).toBeNull();
|
||||||
|
|
|
@ -43,8 +43,10 @@ export async function getFileLastUpdate(
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = shell.exec(`git log -1 --format=%ct,%an ${filePath}`);
|
const result = shell.exec(`git log -1 --format=%ct,%an ${filePath}`);
|
||||||
if (result.stderr) {
|
if (result.code !== 0) {
|
||||||
throw new Error(result.stderr);
|
throw new Error(
|
||||||
|
`Retrieval of git history failed at ${filePath} with exit code ${result.code}: ${result.stderr}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return getTimestampAndAuthor(result.stdout.trim());
|
return getTimestampAndAuthor(result.stdout.trim());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue