@storybook/addon-vitest 0.0.0-pr-31819-sha-b9cc1551 → 0.0.0-pr-31819-sha-8b7e5823

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.
@@ -9,25 +9,24 @@ const require = CJS_COMPAT_NODE_MODULE.createRequire(import.meta.url);
9
9
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
10
10
  // ------------------------------------------------------------
11
11
  import {
12
- a as O,
12
+ a as _,
13
13
  c as I
14
- } from "../_node-chunks/chunk-VFT2PRGV.js";
14
+ } from "../_node-chunks/chunk-L5EWH7GC.js";
15
15
  import {
16
- b as N,
17
- c as G
16
+ b as F,
17
+ c as N
18
18
  } from "../_node-chunks/chunk-CIKGVIS6.js";
19
19
  import {
20
- a as k,
21
- d as x,
20
+ a as O,
21
+ d as k,
22
22
  f as y,
23
23
  j as T,
24
- k as v,
25
- m as F
26
- } from "../_node-chunks/chunk-FMQIQP6D.js";
24
+ k as v
25
+ } from "../_node-chunks/chunk-JSCRRX7J.js";
27
26
  import "../_node-chunks/chunk-N3OFRDD3.js";
28
27
  import {
29
- b as j,
30
- c as P,
28
+ b as x,
29
+ c as j,
31
30
  f as V,
32
31
  g as A
33
32
  } from "../_node-chunks/chunk-W26ZMSD3.js";
@@ -37,22 +36,22 @@ import {
37
36
 
38
37
  // src/node/vitest.ts
39
38
  import S from "node:process";
40
- import { Channel as H } from "storybook/internal/channels";
39
+ import { Channel as z } from "storybook/internal/channels";
41
40
  import {
42
- experimental_UniversalStore as X,
43
- experimental_getStatusStore as q,
44
- experimental_getTestProviderStore as J
41
+ experimental_UniversalStore as H,
42
+ experimental_getStatusStore as X,
43
+ experimental_getTestProviderStore as q
45
44
  } from "storybook/internal/core-server";
46
45
 
47
46
  // src/node/vitest-manager.ts
48
- import { existsSync as W } from "node:fs";
49
- import { getProjectRoot as Y, resolvePathInStorybookCache as $ } from "storybook/internal/common";
47
+ import { existsSync as U } from "node:fs";
48
+ import { getProjectRoot as W, resolvePathInStorybookCache as Y } from "storybook/internal/common";
50
49
 
51
50
  // ../../node_modules/slash/index.js
52
- function M(d) {
51
+ function P(d) {
53
52
  return d.startsWith("\\\\?\\") ? d : d.replace(/\\/g, "/");
54
53
  }
55
- c(M, "slash");
54
+ c(P, "slash");
56
55
 
57
56
  // src/node/reporter.ts
58
57
  var R = class {
@@ -95,7 +94,7 @@ var R = class {
95
94
  };
96
95
 
97
96
  // src/node/vitest-manager.ts
98
- var K = ["mts", "mjs", "cts", "cjs", "ts", "tsx", "js", "jsx"], z = ["ts", "js", "json"];
97
+ var $ = ["mts", "mjs", "cts", "cjs", "ts", "tsx", "js", "jsx"], K = ["ts", "js", "json"];
99
98
  process.env.VITEST_STORYBOOK = "true";
100
99
  var E = class {
101
100
  constructor(t) {
@@ -110,7 +109,7 @@ var E = class {
110
109
  }
111
110
  async startVitest({ coverage: t }) {
112
111
  let { createVitest: e } = await import("vitest/node"), o = [
113
- P(F("@storybook/addon-vitest"), "static/coverage-reporter.cjs"),
112
+ "@storybook/addon-vitest/internal/coverage-reporter",
114
113
  {
115
114
  testManager: this.testManager,
116
115
  coverageOptions: this.vitest?.config?.coverage
@@ -121,13 +120,13 @@ var E = class {
121
120
  cleanOnRerun: !0,
122
121
  reportOnFailure: !0,
123
122
  reporter: [["html", {}], o],
124
- reportsDirectory: $(x)
125
- } : { enabled: !1 }, a = await G(
123
+ reportsDirectory: Y(k)
124
+ } : { enabled: !1 }, a = await N(
126
125
  [
127
- ...z.map((i) => `vitest.workspace.${i}`),
128
- ...K.map((i) => `vitest.config.${i}`)
126
+ ...K.map((i) => `vitest.workspace.${i}`),
127
+ ...$.map((i) => `vitest.config.${i}`)
129
128
  ],
130
- { stopAt: Y() }
129
+ { stopAt: W() }
131
130
  ), r = "storybook:" + process.env.STORYBOOK_CONFIG_DIR;
132
131
  try {
133
132
  this.vitest = await e("test", {
@@ -248,7 +247,7 @@ Please install the @vitest/${u ? "coverage-istanbul" : "coverage-v8"} package to
248
247
  ) ?? [];
249
248
  }
250
249
  async runAffectedTestsAfterChange(t, e) {
251
- let o = M(t);
250
+ let o = P(t);
252
251
  if (this.vitest?.logger.clearHighlightCache(o), this.updateLastChanged(o), e === "add" && this.vitest?.projects.find(this.isStorybookProject.bind(this))?.matchesTestGlob(o), !this.testManager.store.getState().watching || !this.vitest)
253
252
  return;
254
253
  this.resetGlobalTestNamePattern();
@@ -300,8 +299,8 @@ Please install the @vitest/${u ? "coverage-istanbul" : "coverage-v8"} package to
300
299
  let n = [...i.deps ?? [], ...i.dynamicDeps ?? []];
301
300
  await Promise.all(
302
301
  n.map(async (l) => {
303
- let u = l.startsWith("/@fs/") ? l.slice(process.platform === "win32" ? 5 : 4) : P(s.config.root, l);
304
- !u.includes("node_modules") && !e.has(u) && W(u) && await o(s, u);
302
+ let u = l.startsWith("/@fs/") ? l.slice(process.platform === "win32" ? 5 : 4) : j(s.config.root, l);
303
+ !u.includes("node_modules") && !e.has(u) && U(u) && await o(s, u);
305
304
  })
306
305
  );
307
306
  }, "addImports");
@@ -309,7 +308,7 @@ Please install the @vitest/${u ? "coverage-istanbul" : "coverage-v8"} package to
309
308
  }
310
309
  async registerVitestConfigListener() {
311
310
  this.vitest.vite.watcher.on("change", async (t) => {
312
- if (j(t) === this.vitest?.vite?.config.configFile) {
311
+ if (x(t) === this.vitest?.vite?.config.configFile) {
313
312
  I("Restarting Vitest due to config change");
314
313
  let { watching: o, config: s } = this.testManager.store.getState();
315
314
  await this.restartVitest({ coverage: s.coverage && !o });
@@ -330,7 +329,7 @@ Please install the @vitest/${u ? "coverage-istanbul" : "coverage-v8"} package to
330
329
  };
331
330
 
332
331
  // src/node/test-manager.ts
333
- var B = {
332
+ var G = {
334
333
  pending: "status-value:pending",
335
334
  passed: "status-value:success",
336
335
  warning: "status-value:warning",
@@ -353,7 +352,7 @@ var B = {
353
352
  * The throttling (500ms) is necessary as the channel would otherwise get overwhelmed with events,
354
353
  * eventually causing the manager and dev server to lose connection.
355
354
  */
356
- this.throttledFlushTestCaseResults = O(() => {
355
+ this.throttledFlushTestCaseResults = _(() => {
357
356
  let t = this.batchedTestCaseResults;
358
357
  this.batchedTestCaseResults = [], this.store.setState((s) => {
359
358
  let { success: a, error: r } = s.currentRun.componentTestCount, { success: i, warning: n, error: l } = s.currentRun.a11yCount;
@@ -379,7 +378,7 @@ var B = {
379
378
  let e = t.map(({ storyId: s, testResult: a }) => ({
380
379
  storyId: s,
381
380
  typeId: T,
382
- value: B[a.state],
381
+ value: G[a.state],
383
382
  title: "Component tests",
384
383
  description: a.errors?.map((r) => r.stack || r.message).join(`
385
384
  `) ?? "",
@@ -390,7 +389,7 @@ var B = {
390
389
  ({ storyId: s, reports: a }) => a?.filter((r) => r.type === "a11y").map((r) => ({
391
390
  storyId: s,
392
391
  typeId: v,
393
- value: B[r.status],
392
+ value: G[r.status],
394
393
  title: "Accessibility tests",
395
394
  description: "",
396
395
  sidebarContextMenu: !1
@@ -493,7 +492,7 @@ var B = {
493
492
  type: "FATAL_ERROR",
494
493
  payload: {
495
494
  message: t,
496
- error: N(e)
495
+ error: F(e)
497
496
  }
498
497
  });
499
498
  }
@@ -510,7 +509,7 @@ var B = {
510
509
  };
511
510
 
512
511
  // src/node/vitest.ts
513
- var _ = X, L = q, Q = J, D = new H({
512
+ var M = H, B = X, J = q, L = new z({
514
513
  async: !0,
515
514
  transport: {
516
515
  send: /* @__PURE__ */ c((d) => {
@@ -521,13 +520,13 @@ var _ = X, L = q, Q = J, D = new H({
521
520
  }, "setHandler")
522
521
  }
523
522
  });
524
- _.__prepare(D, _.Environment.SERVER);
525
- var Z = _.create(y);
523
+ M.__prepare(L, M.Environment.SERVER);
524
+ var Q = M.create(y);
526
525
  new w({
527
- store: Z,
528
- componentTestStatusStore: L(T),
529
- a11yStatusStore: L(v),
530
- testProviderStore: Q(k),
526
+ store: Q,
527
+ componentTestStatusStore: B(T),
528
+ a11yStatusStore: B(v),
529
+ testProviderStore: J(O),
531
530
  onReady: /* @__PURE__ */ c(() => {
532
531
  S.send?.({ type: "ready" });
533
532
  }, "onReady"),
@@ -536,8 +535,8 @@ new w({
536
535
  }
537
536
  });
538
537
  var C = /* @__PURE__ */ c((d = 0) => {
539
- D?.removeAllListeners(), S.exit(d);
540
- }, "exit"), U = /* @__PURE__ */ c((d) => async (t) => {
538
+ L?.removeAllListeners(), S.exit(d);
539
+ }, "exit"), D = /* @__PURE__ */ c((d) => async (t) => {
541
540
  try {
542
541
  let e = {
543
542
  message: d,
@@ -558,11 +557,11 @@ var C = /* @__PURE__ */ c((d = 0) => {
558
557
  }, "createUnhandledErrorHandler");
559
558
  S.on(
560
559
  "uncaughtException",
561
- U("Uncaught exception in the test runner process")
560
+ D("Uncaught exception in the test runner process")
562
561
  );
563
562
  S.on(
564
563
  "unhandledRejection",
565
- U("Unhandled rejection in the test runner process")
564
+ D("Unhandled rejection in the test runner process")
566
565
  );
567
566
  S.on("exit", C);
568
567
  S.on("SIGINT", () => C(0));
@@ -9,17 +9,17 @@ const require = CJS_COMPAT_NODE_MODULE.createRequire(import.meta.url);
9
9
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
10
10
  // ------------------------------------------------------------
11
11
  import {
12
- a as Ye
13
- } from "./_node-chunks/chunk-XWQZZ2C3.js";
12
+ a as Ye,
13
+ d as He
14
+ } from "./_node-chunks/chunk-RCVH25XB.js";
14
15
  import {
15
16
  a as Ue,
16
17
  c as me
17
18
  } from "./_node-chunks/chunk-CIKGVIS6.js";
18
19
  import {
19
20
  c as C,
20
- e as Ge,
21
- m as He
22
- } from "./_node-chunks/chunk-FMQIQP6D.js";
21
+ e as Ge
22
+ } from "./_node-chunks/chunk-JSCRRX7J.js";
23
23
  import {
24
24
  c as Be,
25
25
  d as F,
package/dist/preset.js CHANGED
@@ -11,10 +11,11 @@ const require = CJS_COMPAT_NODE_MODULE.createRequire(import.meta.url);
11
11
  import {
12
12
  b as N,
13
13
  c as p
14
- } from "./_node-chunks/chunk-VFT2PRGV.js";
14
+ } from "./_node-chunks/chunk-L5EWH7GC.js";
15
15
  import {
16
- b as L
17
- } from "./_node-chunks/chunk-XWQZZ2C3.js";
16
+ b as L,
17
+ c as F
18
+ } from "./_node-chunks/chunk-RCVH25XB.js";
18
19
  import {
19
20
  a as A,
20
21
  b as P,
@@ -22,9 +23,8 @@ import {
22
23
  f as R,
23
24
  g as E,
24
25
  h as I,
25
- i as D,
26
- l as F
27
- } from "./_node-chunks/chunk-FMQIQP6D.js";
26
+ i as D
27
+ } from "./_node-chunks/chunk-JSCRRX7J.js";
28
28
  import {
29
29
  a as Y
30
30
  } from "./_node-chunks/chunk-N3OFRDD3.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-vitest",
3
- "version": "0.0.0-pr-31819-sha-b9cc1551",
3
+ "version": "0.0.0-pr-31819-sha-8b7e5823",
4
4
  "description": "Storybook addon for testing components",
5
5
  "keywords": [
6
6
  "storybook-addons",
@@ -43,7 +43,6 @@
43
43
  "./package.json": "./package.json",
44
44
  "./postinstall": "./dist/postinstall.js",
45
45
  "./preset": "./dist/preset.js",
46
- "./static/coverage-reporter.cjs": "./static/coverage-reporter.cjs",
47
46
  "./vitest": "./dist/node/vitest.js",
48
47
  "./vitest-plugin": {
49
48
  "types": "./dist/vitest-plugin/index.d.ts",
@@ -100,7 +99,7 @@
100
99
  "peerDependencies": {
101
100
  "@vitest/browser": "^3.0.0",
102
101
  "@vitest/runner": "^3.0.0",
103
- "storybook": "^0.0.0-pr-31819-sha-b9cc1551",
102
+ "storybook": "^0.0.0-pr-31819-sha-8b7e5823",
104
103
  "vitest": "^3.0.0"
105
104
  },
106
105
  "peerDependenciesMeta": {
@@ -1,10 +0,0 @@
1
- /**
2
- * This exists because the code loading this uses `Cont = require(name)`.
3
- *
4
- * That code is in node_modules/../ some istanbul util file, which we cannot change.
5
- *
6
- * So we have to create a CJS file that requires the ESM file.
7
- *
8
- * The key compatibility that we're doing here, is the `.default` at the end.
9
- */
10
- module.exports = require('@storybook/addon-vitest/internal/coverage-reporter').default;