@lvce-editor/test-worker 6.7.0 → 7.0.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 CHANGED
@@ -18,7 +18,7 @@ export interface LocatorExpect {
18
18
  readonly toHaveValue: (value: string) => Promise<void>;
19
19
  readonly toBeFocused: () => Promise<void>;
20
20
  readonly toHaveCSS: (key: string, value: string) => Promise<void>;
21
- readonly toHaveAttribute: (key: string, value: string) => Promise<void>;
21
+ readonly toHaveAttribute: (key: string, value: string | null) => Promise<void>;
22
22
  readonly toHaveJSProperty: (key: string, value: any) => Promise<void>;
23
23
  readonly toHaveClass: (className: string) => Promise<void>;
24
24
  readonly toHaveId: (id: string) => Promise<void>;
@@ -57,7 +57,6 @@ export interface FileSystemTmpDirOptions {
57
57
 
58
58
  interface Workspace {
59
59
  readonly openTmpDir: () => Promise<string>;
60
- readonly resolveFileUrl: (url: string) => string;
61
60
  readonly setPath: (path: string) => Promise<void>;
62
61
  }
63
62
 
@@ -2562,14 +2562,17 @@ const createDroppedFileHandle = async () => {
2562
2562
  };
2563
2563
  };
2564
2564
  const loadFixture = async (platform, url) => {
2565
+ if (typeof url !== 'string') {
2566
+ throw new TypeError(`fixture url must be of type string`);
2567
+ }
2565
2568
  // Handle fixture URLs in web environment
2566
2569
  if (platform === Web) {
2567
2570
  const fileMapUrl = `${url}/fileMap.json`;
2568
- // @ts-ignore
2569
- loadFileMap(fileMapUrl);
2570
- // TODO add those files to memory file system
2571
- // TODO then return the memory file system url
2572
- return '';
2571
+ const fileMap = await loadFileMap(fileMapUrl);
2572
+ for (const [key, value] of Object.entries(fileMap)) {
2573
+ await writeFile(`memfs:///${key}`, value);
2574
+ }
2575
+ return 'memfs:///';
2573
2576
  }
2574
2577
 
2575
2578
  // TODO maybe also create a memory file system for consistency with web
@@ -3568,19 +3571,9 @@ const openTmpDir = async () => {
3568
3571
  return tmpDir;
3569
3572
  };
3570
3573
 
3571
- /**
3572
- * @deprecated use FileSystem.loadFixture instead
3573
- */
3574
- const resolveFileUrl = url => {
3575
- // TODO covert remote url to file url
3576
- // then set that as workspace path
3577
- return toFileUrl(url);
3578
- };
3579
-
3580
3574
  const Workspace = {
3581
3575
  __proto__: null,
3582
3576
  openTmpDir,
3583
- resolveFileUrl,
3584
3577
  setPath
3585
3578
  };
3586
3579
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "6.7.0",
3
+ "version": "7.0.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",