mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-31 07:18:59 +02:00
refactor: convert all fs methods to async (#6725)
* refactor: convert all fs methods to async * fix snap
This commit is contained in:
parent
c0b3c9af65
commit
c6d0d812eb
46 changed files with 518 additions and 429 deletions
|
@ -185,9 +185,9 @@ describe('docsVersion', () => {
|
|||
});
|
||||
|
||||
test('first time versioning', async () => {
|
||||
const copyMock = jest.spyOn(fs, 'copySync').mockImplementation();
|
||||
const ensureMock = jest.spyOn(fs, 'ensureDirSync').mockImplementation();
|
||||
const writeMock = jest.spyOn(fs, 'writeFileSync');
|
||||
const copyMock = jest.spyOn(fs, 'copy').mockImplementation();
|
||||
const ensureMock = jest.spyOn(fs, 'ensureDir').mockImplementation();
|
||||
const writeMock = jest.spyOn(fs, 'writeFile');
|
||||
let versionedSidebar;
|
||||
let versionedSidebarPath;
|
||||
writeMock.mockImplementationOnce((filepath, content) => {
|
||||
|
@ -242,9 +242,9 @@ describe('docsVersion', () => {
|
|||
});
|
||||
|
||||
test('not the first time versioning', async () => {
|
||||
const copyMock = jest.spyOn(fs, 'copySync').mockImplementation();
|
||||
const ensureMock = jest.spyOn(fs, 'ensureDirSync').mockImplementation();
|
||||
const writeMock = jest.spyOn(fs, 'writeFileSync');
|
||||
const copyMock = jest.spyOn(fs, 'copy').mockImplementation();
|
||||
const ensureMock = jest.spyOn(fs, 'ensureDir').mockImplementation();
|
||||
const writeMock = jest.spyOn(fs, 'writeFile');
|
||||
let versionedSidebar;
|
||||
let versionedSidebarPath;
|
||||
writeMock.mockImplementationOnce((filepath, content) => {
|
||||
|
@ -301,9 +301,9 @@ describe('docsVersion', () => {
|
|||
test('second docs instance versioning', async () => {
|
||||
const pluginId = 'community';
|
||||
|
||||
const copyMock = jest.spyOn(fs, 'copySync').mockImplementation();
|
||||
const ensureMock = jest.spyOn(fs, 'ensureDirSync').mockImplementation();
|
||||
const writeMock = jest.spyOn(fs, 'writeFileSync');
|
||||
const copyMock = jest.spyOn(fs, 'copy').mockImplementation();
|
||||
const ensureMock = jest.spyOn(fs, 'ensureDir').mockImplementation();
|
||||
const writeMock = jest.spyOn(fs, 'writeFile');
|
||||
let versionedSidebar;
|
||||
let versionedSidebarPath;
|
||||
writeMock.mockImplementationOnce((filepath, content) => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import shell from 'shelljs';
|
||||
|
||||
|
@ -64,9 +64,9 @@ describe('lastUpdate', () => {
|
|||
|
||||
test('temporary created file that has no git timestamp', async () => {
|
||||
const tempFilePath = path.join(__dirname, '__fixtures__', '.temp');
|
||||
fs.writeFileSync(tempFilePath, 'Lorem ipsum :)');
|
||||
await fs.writeFile(tempFilePath, 'Lorem ipsum :)');
|
||||
await expect(getFileLastUpdate(tempFilePath)).resolves.toBeNull();
|
||||
fs.unlinkSync(tempFilePath);
|
||||
await fs.unlink(tempFilePath);
|
||||
});
|
||||
|
||||
test('Git does not exist', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue