@lvce-editor/test-worker 15.3.0 → 15.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +16 -2
- package/dist/testWorkerMain.js +47 -5
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -162,6 +162,16 @@ export interface Dirent {
|
|
|
162
162
|
readonly type: number;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
export interface GitInitOptions {
|
|
166
|
+
readonly bare?: boolean;
|
|
167
|
+
readonly initialBranch?: string;
|
|
168
|
+
readonly uri?: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface GitPushOptions {
|
|
172
|
+
readonly setUpstream?: readonly string[];
|
|
173
|
+
}
|
|
174
|
+
|
|
165
175
|
export interface GitInvocation {
|
|
166
176
|
readonly command: readonly string[];
|
|
167
177
|
readonly cwd: string;
|
|
@@ -637,6 +647,7 @@ interface FileSystem {
|
|
|
637
647
|
readonly readFile: (uri: string) => Promise<string>;
|
|
638
648
|
readonly remove: (uri: string) => Promise<void>;
|
|
639
649
|
readonly setFiles: (files: readonly FileItem[]) => Promise<void>;
|
|
650
|
+
readonly shouldHaveFile: (uri: string, expectedContent: string) => Promise<void>;
|
|
640
651
|
readonly shouldHaveFolder: (uri: string) => Promise<void>;
|
|
641
652
|
readonly writeFile: (uri: string, content: string) => Promise<void>;
|
|
642
653
|
readonly writeJson: (uri: string, data: any) => Promise<void>;
|
|
@@ -667,14 +678,17 @@ interface Git {
|
|
|
667
678
|
readonly checkout: (ref: string) => Promise<void>;
|
|
668
679
|
readonly clone: (repositoryUrl: string, cwd: string) => Promise<void>;
|
|
669
680
|
readonly commit: (message: string) => Promise<void>;
|
|
681
|
+
readonly config: (values: Record<string, string>) => Promise<void>;
|
|
670
682
|
readonly fetch: (remote: string) => Promise<void>;
|
|
671
|
-
readonly init: () => Promise<void>;
|
|
683
|
+
readonly init: (options?: GitInitOptions) => Promise<void>;
|
|
672
684
|
readonly pull: (remote: string, branch: string) => Promise<void>;
|
|
673
|
-
readonly push: (
|
|
685
|
+
readonly push: (remoteOrOptions?: string | GitPushOptions, branch?: string) => Promise<void>;
|
|
674
686
|
readonly setConfig: (key: string, value: string) => Promise<void>;
|
|
675
687
|
readonly shouldHaveCommit: (message: string) => Promise<void>;
|
|
676
688
|
readonly shouldHaveInvocations: (invocations: readonly GitInvocation[]) => Promise<void>;
|
|
689
|
+
readonly stash: (message?: string) => Promise<void>;
|
|
677
690
|
readonly status: () => Promise<unknown>;
|
|
691
|
+
readonly unstash: () => Promise<void>;
|
|
678
692
|
}
|
|
679
693
|
|
|
680
694
|
interface IconTheme {
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -1139,6 +1139,7 @@ const create = rpcId => {
|
|
|
1139
1139
|
};
|
|
1140
1140
|
|
|
1141
1141
|
const Directory = 3;
|
|
1142
|
+
const File = 7;
|
|
1142
1143
|
|
|
1143
1144
|
const Script$1 = 2;
|
|
1144
1145
|
|
|
@@ -3795,6 +3796,22 @@ const shouldHaveFolder = async uri => {
|
|
|
3795
3796
|
throw new AssertionError(`expected filesystem entry "${uri}" to be a folder but it was type ${matchingDirent.type}`);
|
|
3796
3797
|
}
|
|
3797
3798
|
};
|
|
3799
|
+
const shouldHaveFile = async (uri, expectedContent) => {
|
|
3800
|
+
const parentUri = getParentUri(uri);
|
|
3801
|
+
const fileName = getBaseName(uri);
|
|
3802
|
+
const dirents = await readDir(parentUri);
|
|
3803
|
+
const matchingDirent = dirents.find(dirent => dirent.name === fileName);
|
|
3804
|
+
if (!matchingDirent) {
|
|
3805
|
+
throw new AssertionError(`expected filesystem to have file "${uri}" but it was not found`);
|
|
3806
|
+
}
|
|
3807
|
+
if (matchingDirent.type !== File) {
|
|
3808
|
+
throw new AssertionError(`expected filesystem entry "${uri}" to be a file but it was type ${matchingDirent.type}`);
|
|
3809
|
+
}
|
|
3810
|
+
const actualContent = await readFile(uri);
|
|
3811
|
+
if (actualContent !== expectedContent) {
|
|
3812
|
+
throw new AssertionError(`expected file "${uri}" to have content "${expectedContent}" but got "${actualContent}"`);
|
|
3813
|
+
}
|
|
3814
|
+
};
|
|
3798
3815
|
const remove = async uri => {
|
|
3799
3816
|
await invoke('FileSystem.remove', uri);
|
|
3800
3817
|
};
|
|
@@ -3876,6 +3893,7 @@ const FileSystem = {
|
|
|
3876
3893
|
readFile,
|
|
3877
3894
|
remove,
|
|
3878
3895
|
setFiles,
|
|
3896
|
+
shouldHaveFile,
|
|
3879
3897
|
shouldHaveFolder,
|
|
3880
3898
|
writeFile,
|
|
3881
3899
|
writeJson
|
|
@@ -3945,8 +3963,8 @@ const FindWidget = {
|
|
|
3945
3963
|
toggleUseRegularExpression: toggleUseRegularExpression$1
|
|
3946
3964
|
};
|
|
3947
3965
|
|
|
3948
|
-
const init = async () => {
|
|
3949
|
-
await invoke('ExtensionHost.executeCommand', 'git.init');
|
|
3966
|
+
const init = async (options = {}) => {
|
|
3967
|
+
await invoke('ExtensionHost.executeCommand', 'git.init', options);
|
|
3950
3968
|
};
|
|
3951
3969
|
const clone = async (repositoryUrl, cwd) => {
|
|
3952
3970
|
await invoke('ExtensionHost.executeCommand', 'git.clone', repositoryUrl, cwd);
|
|
@@ -3957,8 +3975,14 @@ const add = async pathSpec => {
|
|
|
3957
3975
|
const commit = async message => {
|
|
3958
3976
|
await invoke('ExtensionHost.executeCommand', 'git.commit', message);
|
|
3959
3977
|
};
|
|
3960
|
-
const push$1 = async (
|
|
3961
|
-
|
|
3978
|
+
const push$1 = async (remoteOrOptions, branch) => {
|
|
3979
|
+
if (typeof remoteOrOptions === 'string') {
|
|
3980
|
+
await invoke('ExtensionHost.executeCommand', 'git.push', {
|
|
3981
|
+
setUpstream: [remoteOrOptions, branch || '']
|
|
3982
|
+
});
|
|
3983
|
+
return;
|
|
3984
|
+
}
|
|
3985
|
+
await invoke('ExtensionHost.executeCommand', 'git.push', remoteOrOptions || {});
|
|
3962
3986
|
};
|
|
3963
3987
|
const pull = async (remote, branch) => {
|
|
3964
3988
|
await invoke('ExtensionHost.executeCommand', 'git.pull', remote, branch);
|
|
@@ -3966,6 +3990,16 @@ const pull = async (remote, branch) => {
|
|
|
3966
3990
|
const fetch$1 = async remote => {
|
|
3967
3991
|
await invoke('ExtensionHost.executeCommand', 'git.fetch', remote);
|
|
3968
3992
|
};
|
|
3993
|
+
const stash = async message => {
|
|
3994
|
+
if (message === undefined) {
|
|
3995
|
+
await invoke('ExtensionHost.executeCommand', 'git.stash');
|
|
3996
|
+
return;
|
|
3997
|
+
}
|
|
3998
|
+
await invoke('ExtensionHost.executeCommand', 'git.stash', message);
|
|
3999
|
+
};
|
|
4000
|
+
const unstash = async () => {
|
|
4001
|
+
await invoke('ExtensionHost.executeCommand', 'git.unstash');
|
|
4002
|
+
};
|
|
3969
4003
|
const checkout = async ref => {
|
|
3970
4004
|
await invoke('ExtensionHost.executeCommand', 'git.checkout', ref);
|
|
3971
4005
|
};
|
|
@@ -3981,6 +4015,11 @@ const addRemote = async (name, remoteUrl) => {
|
|
|
3981
4015
|
const setConfig = async (key, value) => {
|
|
3982
4016
|
await invoke('ExtensionHost.executeCommand', 'git.setConfig', key, value);
|
|
3983
4017
|
};
|
|
4018
|
+
const config = async values => {
|
|
4019
|
+
for (const [key, value] of Object.entries(values)) {
|
|
4020
|
+
await setConfig(key, value);
|
|
4021
|
+
}
|
|
4022
|
+
};
|
|
3984
4023
|
const shouldHaveCommit = async message => {
|
|
3985
4024
|
const commits = await invoke('ExtensionHost.executeCommand', 'git.getCommits');
|
|
3986
4025
|
if (!Array.isArray(commits)) {
|
|
@@ -4007,6 +4046,7 @@ const Git = {
|
|
|
4007
4046
|
checkout,
|
|
4008
4047
|
clone,
|
|
4009
4048
|
commit,
|
|
4049
|
+
config,
|
|
4010
4050
|
fetch: fetch$1,
|
|
4011
4051
|
init,
|
|
4012
4052
|
pull,
|
|
@@ -4014,7 +4054,9 @@ const Git = {
|
|
|
4014
4054
|
setConfig,
|
|
4015
4055
|
shouldHaveCommit,
|
|
4016
4056
|
shouldHaveInvocations,
|
|
4017
|
-
|
|
4057
|
+
stash,
|
|
4058
|
+
status,
|
|
4059
|
+
unstash
|
|
4018
4060
|
};
|
|
4019
4061
|
|
|
4020
4062
|
const setIconTheme = async id => {
|