mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Handle copy as part of fake FS
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
f7c3657e60
commit
af48b7de5f
@ -29,6 +29,7 @@ const fsInjectable = getInjectable({
|
|||||||
writeJsonSync,
|
writeJsonSync,
|
||||||
pathExistsSync,
|
pathExistsSync,
|
||||||
pathExists,
|
pathExists,
|
||||||
|
copy,
|
||||||
} = fse;
|
} = fse;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -46,6 +47,7 @@ const fsInjectable = getInjectable({
|
|||||||
lstat,
|
lstat,
|
||||||
rm,
|
rm,
|
||||||
access,
|
access,
|
||||||
|
copy: copy as (src: string, dest: string, options?: fse.CopyOptions) => Promise<void>,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
causesSideEffects: true,
|
causesSideEffects: true,
|
||||||
|
|||||||
@ -5,7 +5,10 @@
|
|||||||
import type { DiContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import fsInjectable from "../common/fs/fs.injectable";
|
import fsInjectable from "../common/fs/fs.injectable";
|
||||||
import { createFsFromVolume, Volume } from "memfs";
|
import { createFsFromVolume, Volume } from "memfs";
|
||||||
import type { readJsonSync as readJsonSyncImpl, writeJsonSync as writeJsonSyncImpl } from "fs-extra";
|
import type {
|
||||||
|
readJsonSync as readJsonSyncImpl,
|
||||||
|
writeJsonSync as writeJsonSyncImpl,
|
||||||
|
} from "fs-extra";
|
||||||
|
|
||||||
export const getOverrideFsWithFakes = () => {
|
export const getOverrideFsWithFakes = () => {
|
||||||
const root = createFsFromVolume(Volume.fromJSON({}));
|
const root = createFsFromVolume(Volume.fromJSON({}));
|
||||||
@ -46,6 +49,7 @@ export const getOverrideFsWithFakes = () => {
|
|||||||
lstat: root.promises.lstat as any,
|
lstat: root.promises.lstat as any,
|
||||||
rm: root.promises.rm,
|
rm: root.promises.rm,
|
||||||
access: root.promises.access,
|
access: root.promises.access,
|
||||||
|
copy: async (src, dest) => { throw new Error(`Tried to copy '${src}' to '${dest}'. Copying is not yet supported`); },
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user