@vitest/browser 0.32.1 → 0.32.3

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.
@@ -17,8 +17,8 @@
17
17
  })()
18
18
  </script>
19
19
  <!-- !LOAD_METADATA! -->
20
- <script type="module" crossorigin src="./assets/index-fcbfbe57.js"></script>
21
- <link rel="stylesheet" href="./assets/index-eeb0f8e1.css">
20
+ <script type="module" crossorigin src="./assets/index-984a6a88.js"></script>
21
+ <link rel="stylesheet" href="./assets/index-55f17930.css">
22
22
  </head>
23
23
  <body>
24
24
  <div id="app"></div>
@@ -366,14 +366,14 @@ function isAggregateError(err) {
366
366
  }
367
367
  class StateManager {
368
368
  constructor() {
369
- this.filesMap = /* @__PURE__ */ new Map();
370
- this.pathsSet = /* @__PURE__ */ new Set();
371
- this.collectingPromise = void 0;
372
- this.browserTestPromises = /* @__PURE__ */ new Map();
373
- this.idMap = /* @__PURE__ */ new Map();
374
- this.taskFileMap = /* @__PURE__ */ new WeakMap();
375
- this.errorsSet = /* @__PURE__ */ new Set();
376
- this.processTimeoutCauses = /* @__PURE__ */ new Set();
369
+ __publicField(this, "filesMap", /* @__PURE__ */ new Map());
370
+ __publicField(this, "pathsSet", /* @__PURE__ */ new Set());
371
+ __publicField(this, "collectingPromise");
372
+ __publicField(this, "browserTestPromises", /* @__PURE__ */ new Map());
373
+ __publicField(this, "idMap", /* @__PURE__ */ new Map());
374
+ __publicField(this, "taskFileMap", /* @__PURE__ */ new WeakMap());
375
+ __publicField(this, "errorsSet", /* @__PURE__ */ new Set());
376
+ __publicField(this, "processTimeoutCauses", /* @__PURE__ */ new Set());
377
377
  }
378
378
  catchError(err, type) {
379
379
  if (isAggregateError(err))
@@ -575,33 +575,33 @@ function createClient(url2, options = {}) {
575
575
  return ctx;
576
576
  }
577
577
  const { get } = Reflect;
578
- const safeRandom = Math.random;
579
578
  function withSafeTimers(getTimers, fn) {
579
+ var _a;
580
580
  const { setTimeout: setTimeout2, clearTimeout, nextTick, setImmediate, clearImmediate } = getTimers();
581
581
  const currentSetTimeout = globalThis.setTimeout;
582
582
  const currentClearTimeout = globalThis.clearTimeout;
583
- const currentRandom = globalThis.Math.random;
584
- const currentNextTick = globalThis.process.nextTick;
585
583
  const currentSetImmediate = globalThis.setImmediate;
586
584
  const currentClearImmediate = globalThis.clearImmediate;
585
+ const currentNextTick = (_a = globalThis.process) == null ? void 0 : _a.nextTick;
587
586
  try {
588
587
  globalThis.setTimeout = setTimeout2;
589
588
  globalThis.clearTimeout = clearTimeout;
590
- globalThis.Math.random = safeRandom;
591
- globalThis.process.nextTick = nextTick;
592
589
  globalThis.setImmediate = setImmediate;
593
590
  globalThis.clearImmediate = clearImmediate;
591
+ if (globalThis.process)
592
+ globalThis.process.nextTick = nextTick;
594
593
  const result = fn();
595
594
  return result;
596
595
  } finally {
597
596
  globalThis.setTimeout = currentSetTimeout;
598
597
  globalThis.clearTimeout = currentClearTimeout;
599
- globalThis.Math.random = currentRandom;
600
598
  globalThis.setImmediate = currentSetImmediate;
601
599
  globalThis.clearImmediate = currentClearImmediate;
602
- nextTick(() => {
603
- globalThis.process.nextTick = currentNextTick;
604
- });
600
+ if (globalThis.process) {
601
+ nextTick(() => {
602
+ globalThis.process.nextTick = currentNextTick;
603
+ });
604
+ }
605
605
  }
606
606
  }
607
607
  const promises = /* @__PURE__ */ new Set();
@@ -685,7 +685,7 @@ function importId(id) {
685
685
  }
686
686
  const { Date: Date$1, console: console$1 } = globalThis;
687
687
  async function setupConsoleLogSpy() {
688
- const { stringify: stringify2, format, utilInspect } = await importId("vitest/utils");
688
+ const { stringify: stringify2, format, inspect } = await importId("vitest/utils");
689
689
  const { log, info, error, dir, dirxml, trace, time, timeEnd, timeLog, warn, debug, count, countReset } = console$1;
690
690
  const formatInput = (input) => {
691
691
  if (input instanceof Node)
@@ -721,7 +721,7 @@ async function setupConsoleLogSpy() {
721
721
  console$1.error = stderr(error);
722
722
  console$1.warn = stderr(warn);
723
723
  console$1.dir = (item, options) => {
724
- sendLog("stdout", utilInspect(item, options));
724
+ sendLog("stdout", inspect(item, options));
725
725
  return dir(item, options);
726
726
  };
727
727
  console$1.dirxml = (...args) => {
@@ -838,9 +838,6 @@ class VitestBrowserClientMocker {
838
838
  prepare() {
839
839
  }
840
840
  }
841
- globalThis.process = { env: {}, argv: [], cwd: () => "/", stdout: { write: () => {
842
- } }, nextTick: (cb) => cb() };
843
- globalThis.global = globalThis;
844
841
  const PORT = location.port;
845
842
  const HOST = [location.hostname, PORT].filter(Boolean).join(":");
846
843
  const ENTRY_URL = `${location.protocol === "https:" ? "wss:" : "ws:"}//${HOST}/__vitest_api__`;
@@ -21,7 +21,7 @@
21
21
  border: none;
22
22
  }
23
23
  </style>
24
- <script type="module" crossorigin src="/assets/index-0eaf4198.js"></script>
24
+ <script type="module" crossorigin src="/assets/index-25555a49.js"></script>
25
25
  </head>
26
26
  <body>
27
27
  <iframe id="vitest-ui" src=""></iframe>
package/dist/index.js CHANGED
@@ -1868,7 +1868,10 @@ export default { ${viInjectedKey}: ${viInjectedKey}.default };
1868
1868
  s.prependRight(topNode.start, `const ${id2.name} = ${binding};
1869
1869
  `);
1870
1870
  }
1871
- } else {
1871
+ } else if (
1872
+ // don't transform class name identifier
1873
+ !(parent.type === "ClassExpression" && id2 === parent.id)
1874
+ ) {
1872
1875
  s.update(id2.start, id2.end, binding);
1873
1876
  }
1874
1877
  },
@@ -1935,7 +1938,7 @@ var index = (project, base = "/") => {
1935
1938
  "@vitest/utils"
1936
1939
  ],
1937
1940
  include: [
1938
- "vitest > concordance",
1941
+ "vitest > diff-sequences",
1939
1942
  "vitest > loupe",
1940
1943
  "vitest > pretty-format",
1941
1944
  "vitest > pretty-format > ansi-styles",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/browser",
3
3
  "type": "module",
4
- "version": "0.32.1",
4
+ "version": "0.32.3",
5
5
  "description": "Browser running for Vitest",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -30,7 +30,7 @@
30
30
  "stubs"
31
31
  ],
32
32
  "peerDependencies": {
33
- "vitest": ">=0.31.0"
33
+ "vitest": ">=0.32.3"
34
34
  },
35
35
  "dependencies": {
36
36
  "modern-node-polyfills": "^0.1.3",
@@ -38,14 +38,14 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/estree": "^1.0.1",
41
- "@types/ws": "^8.5.4",
41
+ "@types/ws": "^8.5.5",
42
42
  "estree-walker": "^3.0.3",
43
43
  "periscopic": "^3.1.0",
44
- "rollup": "3.20.2",
45
- "@vitest/runner": "0.32.1",
46
- "@vitest/ui": "0.32.1",
47
- "@vitest/ws-client": "0.32.1",
48
- "vitest": "0.32.1"
44
+ "rollup": "3.25.3",
45
+ "@vitest/ws-client": "0.32.3",
46
+ "@vitest/ui": "0.32.3",
47
+ "vitest": "0.32.3",
48
+ "@vitest/runner": "0.32.3"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "rimraf dist && pnpm build:node && pnpm build:client",