From 57f49ffb836bbd2a91c4334826497fbc0dc0d6c7 Mon Sep 17 00:00:00 2001 From: endiliey Date: Fri, 8 Nov 2019 23:03:22 +0700 Subject: [PATCH] changelog --- CHANGELOG-2.x.md | 2 ++ .../src/__tests__/lastUpdate.test.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG-2.x.md b/CHANGELOG-2.x.md index 455b684cba41..fa17b9f480fc 100644 --- a/CHANGELOG-2.x.md +++ b/CHANGELOG-2.x.md @@ -3,6 +3,8 @@ ## Unreleased - More efficient hot reload & consistent generated file. - Set babel `compact` options to `true` which removes "superfluous whitespace characters and line terminators. +- Skip fileHash caching on production calculation to improve build performance. The runtime cache is only useful in development. +- Obtain git timestamp for `showLastUpdateAuthor`/ `showLastUpdateTime` asynchronously instead of synchronously. This improves build performance greatly. ## 2.0.0-alpha.33 diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/lastUpdate.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/lastUpdate.test.ts index 434ce5c72d3b..07142650994d 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/lastUpdate.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/lastUpdate.test.ts @@ -30,11 +30,7 @@ describe('lastUpdate', () => { test('non-existing file', async () => { const consoleMock = jest.spyOn(console, 'error'); - consoleMock.mockImplementationOnce(err => { - expect(err).toMatchInlineSnapshot( - `[Error: Command failed with exit code 128: git log -1 --format=%ct, %an /mnt/c/Users/endij/Desktop/Linux/Docusaurus/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/.nonExisting]`, - ); - }); + consoleMock.mockImplementation(); const nonExistingFilePath = path.join( __dirname, '__fixtures__', @@ -42,6 +38,11 @@ describe('lastUpdate', () => { ); expect(await lastUpdate(nonExistingFilePath)).toBeNull(); expect(consoleMock).toHaveBeenCalledTimes(1); + expect(consoleMock).toHaveBeenCalledWith( + new Error( + `Command failed with exit code 128: git log -1 --format=%ct, %an ${nonExistingFilePath}`, + ), + ); expect(await lastUpdate(null)).toBeNull(); expect(await lastUpdate(undefined)).toBeNull(); consoleMock.mockRestore();