webanvil 0.0.13 → 0.0.16

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/README.md CHANGED
@@ -83,10 +83,10 @@ npm install --save-dev webanvil
83
83
  ```
84
84
 
85
85
  Your package manager remains responsible for dependencies, the lockfile, and
86
- the installed tree. WebAnvil never installs or updates tools. When a supported
87
- tool is declared directly by the active project, or by a workspace that contains
88
- it, WebAnvil uses that installed version. Otherwise it uses the exact version
89
- shipped with WebAnvil.
86
+ the installed tree. WebAnvil never installs or updates tools. Except for the
87
+ bundled Vitest and Playwright test toolchains, WebAnvil uses a compatible tool
88
+ declared directly by the active project or containing workspace before its
89
+ exact fallback.
90
90
 
91
91
  Add the scripts you want to `package.json`:
92
92
 
@@ -203,8 +203,8 @@ package build still owns `--out-dir`.
203
203
  Set `storybook.test: false` to exclude Storybook stories, including `play`
204
204
  functions, from `wa test`. Chromium is downloaded by
205
205
  `@playwright/browser-chromium` when your package manager runs install scripts.
206
- If the project declares Vitest, Storybook tests require version `4.1.10` to
207
- match the bundled browser provider.
206
+ Storybook tests use WebAnvil's bundled Vitest and browser provider as one
207
+ version-matched toolchain.
208
208
 
209
209
  ### A Node project
210
210
 
@@ -335,7 +335,8 @@ over the matching WebAnvil block.
335
335
  ### Tool selection
336
336
 
337
337
  WebAnvil selects compatible project and workspace declarations before its own
338
- fallbacks. A transitive or merely hoisted package is not selected. Each command
338
+ fallbacks, except for its bundled Vitest and Playwright test toolchains. A
339
+ transitive or merely hoisted package is not selected. Each command
339
340
  preflights the engines it can dispatch before `webanvil.config.*` is loaded or
340
341
  its plugins are evaluated, so a declared command engine that is missing, has
341
342
  invalid package identity, or is outside the supported range fails first.
@@ -343,13 +344,13 @@ invalid package identity, or is outside the supported range fails first.
343
344
  | Tool | Supported project/workspace versions | Exact WebAnvil fallback |
344
345
  | ---------------------------- | ------------------------------------ | ----------------------- |
345
346
  | Vite | `>=8.1.5 <9` | `8.1.5` |
346
- | Vitest | `>=4.1.10 <5` | `4.1.10` |
347
+ | Vitest | Bundled only | `4.1.11` |
347
348
  | Playwright Test and Chromium | Bundled only | `1.58.2` |
348
349
  | Storybook | `>=10.5.9 <11` | `10.5.9` |
349
350
  | Rolldown | `>=1.2.0 <2` | `1.2.0` |
350
351
  | Oxlint | `>=1.75.0 <2` | `1.75.0` |
351
352
  | Oxfmt | `>=0.60.0 <0.61` | `0.60.0` |
352
- | TypeScript (declarations) | `>=5 <7` | `6.0.3` |
353
+ | TypeScript (declarations) | `>=5 <7.1.0` | `6.0.3` |
353
354
  | TypeScript Native (`tsgo`) | `>=7.0.0-dev.20260707.2 <7.0.0` | `7.0.0-dev.20260707.2` |
354
355
 
355
356
  When a tool is first used, the CLI reports its package, version, and source, for
@@ -360,8 +361,9 @@ The TypeScript compiler is selected only after configuration enables a
360
361
  declaration build, but before Rolldown starts that build. It follows the same
361
362
  direct project/workspace declaration and exact-fallback rules.
362
363
 
363
- `wa e2e` always uses WebAnvil's bundled Playwright Test and Chromium. This keeps
364
- the runner and `webanvil/e2e` test API on the same version.
364
+ `wa test` and `wa e2e` always use WebAnvil's bundled Vitest and Playwright
365
+ toolchains. This keeps each runner on the same version as its `webanvil/test` or
366
+ `webanvil/e2e` API.
365
367
 
366
368
  ### Native tool configuration
367
369
 
@@ -507,6 +509,24 @@ These are run-specific modes; keep persistent Vitest configuration in
507
509
  `vitest.config.*`. `--ui-port` selects a strict loopback port and requires
508
510
  `--ui`.
509
511
 
512
+ Import the bundled test API from WebAnvil so test registration and execution
513
+ always use the same Vitest instance:
514
+
515
+ ```ts
516
+ import { context, describe, expect, it } from "webanvil/test"
517
+
518
+ describe("calculator", () => {
519
+ context("with two values", () => {
520
+ it("adds them", () => {
521
+ expect(1 + 1).toBe(2)
522
+ })
523
+ })
524
+ })
525
+ ```
526
+
527
+ Native Vitest configuration can import `defineConfig` from
528
+ `webanvil/test/config`.
529
+
510
530
  ### Browser tests
511
531
 
512
532
  `wa e2e` builds a web project, starts a production preview, and runs Playwright
@@ -514,11 +534,15 @@ Test files in `e2e/`. Import the test API from WebAnvil so the runner and test
514
534
  code use the bundled matching version:
515
535
 
516
536
  ```ts
517
- import { expect, test } from "webanvil/e2e"
518
-
519
- test("shows the home page", async ({ page }) => {
520
- await page.goto("/")
521
- await expect(page.getByRole("heading")).toBeVisible()
537
+ import { context, describe, expect, it } from "webanvil/e2e"
538
+
539
+ describe("home page", () => {
540
+ context("when a visitor opens it", () => {
541
+ it("shows its heading", async ({ page }) => {
542
+ await page.goto("/")
543
+ await expect(page.getByRole("heading")).toBeVisible()
544
+ })
545
+ })
522
546
  })
523
547
  ```
524
548
 
@@ -102,7 +102,8 @@ const supportedTools = {
102
102
  },
103
103
  vitest: {
104
104
  packageName: "vitest",
105
- range: ">=4.1.10 <5"
105
+ range: ">=4.1.11 <5",
106
+ allowProjectOverride: false
106
107
  },
107
108
  playwright: {
108
109
  packageName: "@playwright/test",
@@ -131,7 +132,7 @@ const supportedTools = {
131
132
  },
132
133
  typescript: {
133
134
  packageName: "typescript",
134
- range: ">=5 <7"
135
+ range: ">=5 <7.1.0"
135
136
  },
136
137
  "typescript-native": {
137
138
  packageName: "@typescript/native-preview",
@@ -1121,7 +1122,7 @@ const useToolExecutable = async (name, toolchain = new Toolchain(process.cwd()))
1121
1122
  if (tool.executable === void 0) throw new Error(`${tool.packageName} does not expose an executable`);
1122
1123
  return tool.executable;
1123
1124
  };
1124
- const storybookVitestVersion = "4.1.10";
1125
+ const storybookVitestVersion = "4.1.11";
1125
1126
  const relativeModule = (from, to) => {
1126
1127
  const path = relative(from, to).replaceAll("\\", "/");
1127
1128
  return path.startsWith(".") ? path : `./${path}`;
package/dist/e2e.d.mts CHANGED
@@ -1,2 +1,73 @@
1
1
  import { defineConfig, devices, expect, test } from "@playwright/test";
2
- export { defineConfig, devices, expect, test };
2
+ declare const describe: {
3
+ (title: string, callback: () => void): void;
4
+ (callback: () => void): void;
5
+ (title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
6
+ only(title: string, callback: () => void): void;
7
+ only(callback: () => void): void;
8
+ only(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
9
+ skip(title: string, callback: () => void): void;
10
+ skip(callback: () => void): void;
11
+ skip(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
12
+ fixme(title: string, callback: () => void): void;
13
+ fixme(callback: () => void): void;
14
+ fixme(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
15
+ serial: {
16
+ (title: string, callback: () => void): void;
17
+ (callback: () => void): void;
18
+ (title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
19
+ only(title: string, callback: () => void): void;
20
+ only(callback: () => void): void;
21
+ only(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
22
+ };
23
+ parallel: {
24
+ (title: string, callback: () => void): void;
25
+ (callback: () => void): void;
26
+ (title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
27
+ only(title: string, callback: () => void): void;
28
+ only(callback: () => void): void;
29
+ only(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
30
+ };
31
+ configure: (options: {
32
+ mode?: "default" | "parallel" | "serial";
33
+ retries?: number;
34
+ timeout?: number;
35
+ }) => void;
36
+ };
37
+ declare const context: {
38
+ (title: string, callback: () => void): void;
39
+ (callback: () => void): void;
40
+ (title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
41
+ only(title: string, callback: () => void): void;
42
+ only(callback: () => void): void;
43
+ only(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
44
+ skip(title: string, callback: () => void): void;
45
+ skip(callback: () => void): void;
46
+ skip(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
47
+ fixme(title: string, callback: () => void): void;
48
+ fixme(callback: () => void): void;
49
+ fixme(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
50
+ serial: {
51
+ (title: string, callback: () => void): void;
52
+ (callback: () => void): void;
53
+ (title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
54
+ only(title: string, callback: () => void): void;
55
+ only(callback: () => void): void;
56
+ only(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
57
+ };
58
+ parallel: {
59
+ (title: string, callback: () => void): void;
60
+ (callback: () => void): void;
61
+ (title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
62
+ only(title: string, callback: () => void): void;
63
+ only(callback: () => void): void;
64
+ only(title: string, details: import("playwright/test").TestDetails, callback: () => void): void;
65
+ };
66
+ configure: (options: {
67
+ mode?: "default" | "parallel" | "serial";
68
+ retries?: number;
69
+ timeout?: number;
70
+ }) => void;
71
+ };
72
+ declare const it: import("playwright/test").TestType<import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions, import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions>;
73
+ export { context, defineConfig, describe, devices, expect, it, test };
package/dist/e2e.mjs CHANGED
@@ -1,2 +1,5 @@
1
- import { defineConfig, devices, expect, test } from "@playwright/test";
2
- export { defineConfig, devices, expect, test };
1
+ import { defineConfig, devices, expect, test, test as test$1 } from "@playwright/test";
2
+ const describe = test$1.describe;
3
+ const context = test$1.describe;
4
+ const it = test$1;
5
+ export { context, defineConfig, describe, devices, expect, it, test };
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { rename } from "node:fs/promises";
2
2
  import { z } from "zod";
3
3
  import { TsconfigJson } from "get-tsconfig";
4
+ import { TestUserConfig } from "vitest/config";
4
5
  import { InlineConfig, PluginOption, UserConfig as UserConfig$1 } from "vite";
5
6
  import { OxfmtConfig } from "oxfmt";
6
7
  import { OxlintConfig } from "oxlint";
7
8
  import { InputOptions, OutputOptions, Plugin } from "rolldown";
8
- import { TestUserConfig } from "vitest/config";
9
9
  import { IsolatedDeclarationsOptions } from "rolldown/experimental";
10
10
  declare const entry$1: {
11
11
  readonly name: "entry";
@@ -0,0 +1 @@
1
+ export * from "vitest/config";
@@ -0,0 +1,2 @@
1
+ export * from "vitest/config";
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "vitest";
2
+ declare const context: import("vitest").SuiteAPI;
3
+ export { context };
package/dist/test.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { describe } from "vitest";
2
+ export * from "vitest";
3
+ const context = describe;
4
+ export { context };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webanvil",
3
- "version": "0.0.13",
3
+ "version": "0.0.16",
4
4
  "description": "A unified CLI for building, testing, linting, formatting, and type-checking JavaScript and TypeScript projects.",
5
5
  "keywords": [
6
6
  "build-tool",
@@ -46,6 +46,16 @@
46
46
  "import": "./dist/e2e.mjs",
47
47
  "default": "./dist/e2e.mjs"
48
48
  },
49
+ "./test": {
50
+ "types": "./dist/test.d.mts",
51
+ "import": "./dist/test.mjs",
52
+ "default": "./dist/test.mjs"
53
+ },
54
+ "./test/config": {
55
+ "types": "./dist/test/config.d.mts",
56
+ "import": "./dist/test/config.mjs",
57
+ "default": "./dist/test/config.mjs"
58
+ },
49
59
  "./storybook/test/preset": {
50
60
  "types": "./dist/storybook/test/preset.d.mts",
51
61
  "import": "./dist/storybook/test/preset.mjs",
@@ -119,10 +129,10 @@
119
129
  "@storybook/web-components-vite": "10.5.9",
120
130
  "@types/node": "^26.1.1",
121
131
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
122
- "@vitest/browser": "4.1.10",
123
- "@vitest/browser-playwright": "4.1.10",
124
- "@vitest/coverage-v8": "4.1.10",
125
- "@vitest/ui": "4.1.10",
132
+ "@vitest/browser": "4.1.11",
133
+ "@vitest/browser-playwright": "4.1.11",
134
+ "@vitest/coverage-v8": "4.1.11",
135
+ "@vitest/ui": "4.1.11",
126
136
  "c12": "^4.0.0-beta.5",
127
137
  "cmdore": "^0.4.1",
128
138
  "consola": "^3.4.2",
@@ -143,7 +153,7 @@
143
153
  "tinyglobby": "^0.2.15",
144
154
  "typescript": "6.0.3",
145
155
  "vite": "8.1.5",
146
- "vitest": "4.1.10",
156
+ "vitest": "4.1.11",
147
157
  "yaml": "^2.9.0",
148
158
  "zod": "^4.4.3"
149
159
  },