veryfront 0.1.324 → 0.1.326
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/esm/cli/commands/extension/init-command.js +2 -2
- package/esm/cli/commands/extension/validate-command.js +1 -1
- package/esm/deno.d.ts +7 -0
- package/esm/deno.js +8 -1
- package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts +2 -0
- package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts.map +1 -0
- package/esm/deps/esm.sh/react-dom@19.2.4/client.js +5 -0
- package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts +2 -0
- package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts.map +1 -0
- package/esm/deps/esm.sh/scheduler@^0.27.0.js +3 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +47 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +65 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +17 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +25 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +194 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +37 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +61 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +52 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +25 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +28 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +44 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +39 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +32 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +177 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +42 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +58 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +44 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +20 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.d.ts +150 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.js +224 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.d.ts +80 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.js +116 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff.d.ts +140 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff.js +276 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.d.ts +99 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.js +182 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/format.d.ts +29 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/format.js +70 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/styles.d.ts +159 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/styles.js +207 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/types.d.ts +25 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/types.js +3 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.d.ts +80 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.js +348 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.d.ts +738 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.js +656 -0
- package/esm/src/agent/fork-runtime-stream.d.ts +143 -0
- package/esm/src/agent/fork-runtime-stream.d.ts.map +1 -0
- package/esm/src/agent/fork-runtime-stream.js +505 -0
- package/esm/src/agent/index.d.ts +1 -0
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +1 -0
- package/esm/src/chat/conversation.d.ts +5 -5
- package/esm/src/modules/index.d.ts +12 -0
- package/esm/src/modules/index.d.ts.map +1 -0
- package/esm/src/modules/index.js +10 -0
- package/esm/src/modules/module-resolver.d.ts +28 -0
- package/esm/src/modules/module-resolver.d.ts.map +1 -0
- package/esm/src/modules/module-resolver.js +106 -0
- package/esm/src/rendering/cleanup.d.ts +7 -0
- package/esm/src/rendering/cleanup.d.ts.map +1 -0
- package/esm/src/rendering/cleanup.js +22 -0
- package/esm/src/rendering/ssr/index.d.ts +10 -0
- package/esm/src/rendering/ssr/index.d.ts.map +1 -0
- package/esm/src/rendering/ssr/index.js +8 -0
- package/esm/src/rendering/ssr/mdx-module-loader.d.ts +5 -0
- package/esm/src/rendering/ssr/mdx-module-loader.d.ts.map +1 -0
- package/esm/src/rendering/ssr/mdx-module-loader.js +150 -0
- package/esm/src/rendering/ssr/mdx-renderer.d.ts +4 -0
- package/esm/src/rendering/ssr/mdx-renderer.d.ts.map +1 -0
- package/esm/src/rendering/ssr/mdx-renderer.js +44 -0
- package/esm/src/rendering/ssr/types.d.ts +13 -0
- package/esm/src/rendering/ssr/types.d.ts.map +1 -0
- package/esm/src/rendering/ssr/types.js +1 -0
- package/esm/src/sandbox/index.d.ts +1 -0
- package/esm/src/sandbox/index.d.ts.map +1 -1
- package/esm/src/sandbox/index.js +1 -0
- package/esm/src/sandbox/shell-tools.d.ts +39 -0
- package/esm/src/sandbox/shell-tools.d.ts.map +1 -0
- package/esm/src/sandbox/shell-tools.js +177 -0
- package/esm/src/server/shared/index.d.ts +7 -0
- package/esm/src/server/shared/index.d.ts.map +1 -0
- package/esm/src/server/shared/index.js +6 -0
- package/esm/src/testing/assert.d.ts +22 -0
- package/esm/src/testing/assert.d.ts.map +1 -0
- package/esm/src/testing/assert.js +217 -0
- package/esm/src/testing/bdd.d.ts +67 -0
- package/esm/src/testing/bdd.d.ts.map +1 -0
- package/esm/src/testing/bdd.js +401 -0
- package/esm/src/testing/deno-compat.d.ts +26 -0
- package/esm/src/testing/deno-compat.d.ts.map +1 -0
- package/esm/src/testing/deno-compat.js +146 -0
- package/esm/src/testing/index.d.ts +28 -0
- package/esm/src/testing/index.d.ts.map +1 -0
- package/esm/src/testing/index.js +27 -0
- package/esm/src/testing/init.d.ts +2 -0
- package/esm/src/testing/init.d.ts.map +1 -0
- package/esm/src/testing/init.js +18 -0
- package/esm/src/testing/isolation.d.ts +30 -0
- package/esm/src/testing/isolation.d.ts.map +1 -0
- package/esm/src/testing/isolation.js +151 -0
- package/esm/src/testing/timing.d.ts +4 -0
- package/esm/src/testing/timing.d.ts.map +1 -0
- package/esm/src/testing/timing.js +22 -0
- package/esm/src/testing/utils.d.ts +6 -0
- package/esm/src/testing/utils.d.ts.map +1 -0
- package/esm/src/testing/utils.js +49 -0
- package/esm/src/types/global-guards.d.ts +11 -0
- package/esm/src/types/global-guards.d.ts.map +1 -0
- package/esm/src/types/global-guards.js +12 -0
- package/esm/src/utils/cache/keys/namespace.d.ts +3 -0
- package/esm/src/utils/cache/keys/namespace.d.ts.map +1 -0
- package/esm/src/utils/cache/keys/namespace.js +19 -0
- package/esm/src/utils/clsx.d.ts +3 -3
- package/esm/src/utils/clsx.d.ts.map +1 -1
- package/esm/src/utils/clsx.js +2 -3
- package/esm/src/utils/mime-types.d.ts +0 -6
- package/esm/src/utils/mime-types.d.ts.map +1 -1
- package/esm/src/utils/mime-types.js +0 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +14 -1
- package/src/cli/commands/extension/init-command.ts +2 -2
- package/src/cli/commands/extension/validate-command.ts +1 -1
- package/src/deno.js +8 -1
- package/src/deps/esm.sh/@types/react-dom@19.2.3/client.d.ts +105 -0
- package/src/deps/esm.sh/@types/react@19.2.3/global.d.ts +165 -0
- package/src/deps/esm.sh/@types/react@19.2.3/index.d.ts +4301 -0
- package/src/deps/esm.sh/@types/scheduler@0.26.0/index.d.ts +30 -0
- package/src/deps/esm.sh/csstype@3.2.3/index.d.ts +22569 -0
- package/src/deps/esm.sh/react-dom@19.2.4/client.d.ts +105 -0
- package/src/deps/esm.sh/react-dom@19.2.4/client.js +5 -0
- package/src/deps/esm.sh/scheduler@^0.27.0.d.ts +30 -0
- package/src/deps/esm.sh/scheduler@^0.27.0.js +3 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/almost_equals.ts +56 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/array_includes.ts +76 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/assert.ts +24 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/assertion_error.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/equal.ts +226 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/equals.ts +68 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/exists.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/fail.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/false.ts +27 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/greater.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/instance_of.ts +64 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/is_error.ts +65 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/less.ts +29 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/less_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/mod.ts +47 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/not_equals.ts +43 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/not_instance_of.ts +33 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/not_match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.ts +42 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/object_match.ts +224 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/rejects.ts +123 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/strict_equals.ts +68 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/string_includes.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/throws.ts +111 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/unimplemented.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/unreachable.ts +21 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/assertion_state.ts +248 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/build_message.ts +147 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/diff.ts +317 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/diff_str.ts +208 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/format.ts +89 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/styles.ts +233 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/types.ts +30 -0
- package/src/deps/jsr.io/@std/testing/1.0.18/_test_suite.ts +461 -0
- package/src/deps/jsr.io/@std/testing/1.0.18/bdd.ts +1294 -0
- package/src/src/agent/fork-runtime-stream.ts +780 -0
- package/src/src/agent/index.ts +16 -0
- package/src/src/modules/index.ts +43 -0
- package/src/src/modules/module-resolver.ts +145 -0
- package/src/src/rendering/cleanup.ts +27 -0
- package/src/src/rendering/ssr/index.ts +10 -0
- package/src/src/rendering/ssr/mdx-module-loader.ts +185 -0
- package/src/src/rendering/ssr/mdx-renderer.ts +66 -0
- package/src/src/rendering/ssr/types.ts +14 -0
- package/src/src/sandbox/index.ts +9 -0
- package/src/src/sandbox/shell-tools.ts +242 -0
- package/src/src/server/shared/index.ts +12 -0
- package/src/src/testing/assert.ts +352 -0
- package/src/src/testing/bdd.ts +618 -0
- package/src/src/testing/deno-compat.ts +206 -0
- package/src/src/testing/index.ts +92 -0
- package/src/src/testing/init.ts +21 -0
- package/src/src/testing/isolation.ts +177 -0
- package/src/src/testing/timing.ts +27 -0
- package/src/src/testing/utils.ts +44 -0
- package/src/src/types/global-guards.ts +21 -0
- package/src/src/utils/cache/keys/namespace.ts +25 -0
- package/src/src/utils/clsx.ts +2 -4
- package/src/src/utils/mime-types.ts +0 -2
- package/src/src/utils/version-constant.ts +1 -1
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable BDD testing utilities (describe, it, beforeEach, afterEach).
|
|
3
|
+
*
|
|
4
|
+
* In Deno: Direct re-export from @std/testing/bdd (no wrapper)
|
|
5
|
+
* In Node.js: Uses node:test
|
|
6
|
+
* In Bun: Uses bun:test
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import "../../_dnt.polyfills.js";
|
|
11
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
12
|
+
import { isBun, isDeno } from "../platform/compat/runtime.js";
|
|
13
|
+
import { getEnvOverlayStorage } from "../platform/compat/process.js";
|
|
14
|
+
function getActiveEnvOverlay() {
|
|
15
|
+
const storage = getEnvOverlayStorage();
|
|
16
|
+
const store = storage?.getStore();
|
|
17
|
+
return store instanceof Map ? store : null;
|
|
18
|
+
}
|
|
19
|
+
function applyEnvOverlay(base, overlay) {
|
|
20
|
+
if (!overlay)
|
|
21
|
+
return { ...base };
|
|
22
|
+
const merged = { ...base };
|
|
23
|
+
for (const [key, value] of overlay.entries()) {
|
|
24
|
+
if (value === null) {
|
|
25
|
+
delete merged[key];
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
merged[key] = value;
|
|
29
|
+
}
|
|
30
|
+
return merged;
|
|
31
|
+
}
|
|
32
|
+
function installDenoEnvOverlayFacade() {
|
|
33
|
+
if (!isDeno || typeof dntShim.Deno === "undefined" || typeof dntShim.Deno.env === "undefined")
|
|
34
|
+
return;
|
|
35
|
+
const globalAny = dntShim.dntGlobalThis;
|
|
36
|
+
if (globalAny["__vfTestDenoEnvOverlayFacadeInstalled"])
|
|
37
|
+
return;
|
|
38
|
+
globalAny["__vfTestDenoEnvOverlayFacadeInstalled"] = true;
|
|
39
|
+
const originalDenoEnv = {
|
|
40
|
+
get: dntShim.Deno.env.get.bind(dntShim.Deno.env),
|
|
41
|
+
set: dntShim.Deno.env.set.bind(dntShim.Deno.env),
|
|
42
|
+
delete: dntShim.Deno.env.delete.bind(dntShim.Deno.env),
|
|
43
|
+
has: dntShim.Deno.env.has.bind(dntShim.Deno.env),
|
|
44
|
+
toObject: dntShim.Deno.env.toObject.bind(dntShim.Deno.env),
|
|
45
|
+
};
|
|
46
|
+
dntShim.Deno.env.get = (key) => {
|
|
47
|
+
const overlay = getActiveEnvOverlay();
|
|
48
|
+
if (overlay?.has(key))
|
|
49
|
+
return overlay.get(key) ?? undefined;
|
|
50
|
+
return originalDenoEnv.get(key);
|
|
51
|
+
};
|
|
52
|
+
dntShim.Deno.env.set = (key, value) => {
|
|
53
|
+
const overlay = getActiveEnvOverlay();
|
|
54
|
+
if (overlay) {
|
|
55
|
+
overlay.set(key, value);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
originalDenoEnv.set(key, value);
|
|
59
|
+
};
|
|
60
|
+
dntShim.Deno.env.delete = (key) => {
|
|
61
|
+
const overlay = getActiveEnvOverlay();
|
|
62
|
+
if (overlay) {
|
|
63
|
+
overlay.set(key, null);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
originalDenoEnv.delete(key);
|
|
67
|
+
};
|
|
68
|
+
dntShim.Deno.env.has = (key) => {
|
|
69
|
+
const overlay = getActiveEnvOverlay();
|
|
70
|
+
if (overlay?.has(key))
|
|
71
|
+
return overlay.get(key) !== null;
|
|
72
|
+
return originalDenoEnv.has(key);
|
|
73
|
+
};
|
|
74
|
+
dntShim.Deno.env.toObject = () => {
|
|
75
|
+
return applyEnvOverlay(originalDenoEnv.toObject(), getActiveEnvOverlay());
|
|
76
|
+
};
|
|
77
|
+
const processAny = globalAny["process"];
|
|
78
|
+
if (!processAny?.env)
|
|
79
|
+
return;
|
|
80
|
+
const baseProcessEnv = processAny.env;
|
|
81
|
+
processAny.env = new Proxy(baseProcessEnv, {
|
|
82
|
+
get(target, prop, receiver) {
|
|
83
|
+
if (typeof prop !== "string")
|
|
84
|
+
return Reflect.get(target, prop, receiver);
|
|
85
|
+
return dntShim.Deno.env.get(prop);
|
|
86
|
+
},
|
|
87
|
+
set(target, prop, value, receiver) {
|
|
88
|
+
if (typeof prop !== "string")
|
|
89
|
+
return Reflect.set(target, prop, value, receiver);
|
|
90
|
+
dntShim.Deno.env.set(prop, String(value));
|
|
91
|
+
return true;
|
|
92
|
+
},
|
|
93
|
+
deleteProperty(target, prop) {
|
|
94
|
+
if (typeof prop !== "string")
|
|
95
|
+
return Reflect.deleteProperty(target, prop);
|
|
96
|
+
dntShim.Deno.env.delete(prop);
|
|
97
|
+
return true;
|
|
98
|
+
},
|
|
99
|
+
has(target, prop) {
|
|
100
|
+
if (typeof prop !== "string")
|
|
101
|
+
return Reflect.has(target, prop);
|
|
102
|
+
return dntShim.Deno.env.has(prop);
|
|
103
|
+
},
|
|
104
|
+
ownKeys() {
|
|
105
|
+
return Object.keys(dntShim.Deno.env.toObject());
|
|
106
|
+
},
|
|
107
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
108
|
+
if (typeof prop !== "string")
|
|
109
|
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
110
|
+
const value = dntShim.Deno.env.get(prop);
|
|
111
|
+
if (value === undefined)
|
|
112
|
+
return undefined;
|
|
113
|
+
return {
|
|
114
|
+
configurable: true,
|
|
115
|
+
enumerable: true,
|
|
116
|
+
writable: true,
|
|
117
|
+
value,
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async function installDenoEnvOverlayStorage() {
|
|
123
|
+
if (!isDeno)
|
|
124
|
+
return;
|
|
125
|
+
const globalAny = dntShim.dntGlobalThis;
|
|
126
|
+
if (!globalAny["__vfTestDenoEnvOverlay"]) {
|
|
127
|
+
const { AsyncLocalStorage } = await import("node:async_hooks");
|
|
128
|
+
const storage = new AsyncLocalStorage();
|
|
129
|
+
globalAny["__vfTestDenoEnvOverlay"] = {
|
|
130
|
+
storage: {
|
|
131
|
+
getStore: () => storage.getStore(),
|
|
132
|
+
run: (store, fn) => storage.run(store, fn),
|
|
133
|
+
enterWith: (store) => storage.enterWith(store),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
installDenoEnvOverlayFacade();
|
|
138
|
+
}
|
|
139
|
+
function withEnvOverlay(fn) {
|
|
140
|
+
const overlay = getEnvOverlayStorage();
|
|
141
|
+
if (!overlay)
|
|
142
|
+
return fn;
|
|
143
|
+
return ((...args) => {
|
|
144
|
+
if (overlay.run) {
|
|
145
|
+
return overlay.run(new Map(), () => Promise.resolve().then(() => fn(...args)));
|
|
146
|
+
}
|
|
147
|
+
if (overlay.enterWith) {
|
|
148
|
+
overlay.enterWith(new Map());
|
|
149
|
+
}
|
|
150
|
+
return fn(...args);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
// For Deno, we directly use @std/testing/bdd - no wrapper needed
|
|
154
|
+
// This avoids creating a "global" test suite from top-level await
|
|
155
|
+
let denoBdd = null;
|
|
156
|
+
if (isDeno) {
|
|
157
|
+
await installDenoEnvOverlayStorage();
|
|
158
|
+
denoBdd = await import("../../deps/jsr.io/@std/testing/1.0.18/bdd.js");
|
|
159
|
+
}
|
|
160
|
+
let _impl = null;
|
|
161
|
+
function parseBddArgs(nameOrOptions, optionsOrFn, fn) {
|
|
162
|
+
const name = typeof nameOrOptions === "string" ? nameOrOptions : nameOrOptions.name;
|
|
163
|
+
let options = {};
|
|
164
|
+
if (typeof nameOrOptions === "object") {
|
|
165
|
+
options = nameOrOptions;
|
|
166
|
+
}
|
|
167
|
+
else if (typeof optionsOrFn === "object" && typeof optionsOrFn !== "function") {
|
|
168
|
+
options = optionsOrFn;
|
|
169
|
+
}
|
|
170
|
+
const testFn = typeof optionsOrFn === "function" ? optionsOrFn : fn;
|
|
171
|
+
return { name, options, testFn };
|
|
172
|
+
}
|
|
173
|
+
function createNodeImpl(nodeTest) {
|
|
174
|
+
return {
|
|
175
|
+
describe(nameOrOptions, optionsOrFn, fn) {
|
|
176
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
177
|
+
if (!testFn)
|
|
178
|
+
throw new Error("describe requires a test function");
|
|
179
|
+
if (options.skip || options.ignore) {
|
|
180
|
+
nodeTest.describe.skip(name, testFn);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (options.only && nodeTest.describe.only) {
|
|
184
|
+
nodeTest.describe.only(name, testFn);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
nodeTest.describe(name, testFn);
|
|
188
|
+
},
|
|
189
|
+
it(nameOrOptions, optionsOrFn, fn) {
|
|
190
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
191
|
+
if (!testFn)
|
|
192
|
+
throw new Error("it requires a test function");
|
|
193
|
+
if (options.skip || options.ignore) {
|
|
194
|
+
nodeTest.it.skip(name, testFn);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (options.only && nodeTest.it.only) {
|
|
198
|
+
nodeTest.it.only(name, testFn);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (options.timeout !== undefined) {
|
|
202
|
+
nodeTest.it(name, { timeout: options.timeout }, testFn);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
nodeTest.it(name, testFn);
|
|
206
|
+
},
|
|
207
|
+
beforeEach: nodeTest.beforeEach,
|
|
208
|
+
afterEach: nodeTest.afterEach,
|
|
209
|
+
beforeAll: nodeTest.before,
|
|
210
|
+
afterAll: nodeTest.after,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function createBunImpl(bunTest) {
|
|
214
|
+
const defaultTimeout = (() => {
|
|
215
|
+
const env = dntShim.dntGlobalThis.process;
|
|
216
|
+
const raw = env?.env?.BUN_TEST_TIMEOUT ?? env?.env?.VF_TEST_TIMEOUT ?? "30000";
|
|
217
|
+
const parsed = Number(raw);
|
|
218
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 30000;
|
|
219
|
+
})();
|
|
220
|
+
return {
|
|
221
|
+
describe(nameOrOptions, optionsOrFn, fn) {
|
|
222
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
223
|
+
if (!testFn)
|
|
224
|
+
throw new Error("describe requires a test function");
|
|
225
|
+
if ((options.skip || options.ignore) && bunTest.describe.skip) {
|
|
226
|
+
bunTest.describe.skip(name, testFn);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (options.only && bunTest.describe.only) {
|
|
230
|
+
bunTest.describe.only(name, testFn);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
bunTest.describe(name, testFn);
|
|
234
|
+
},
|
|
235
|
+
it(nameOrOptions, optionsOrFn, fn) {
|
|
236
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
237
|
+
if (!testFn)
|
|
238
|
+
throw new Error("it requires a test function");
|
|
239
|
+
const testWithEnv = withEnvOverlay(testFn);
|
|
240
|
+
const isSkip = options.skip || options.ignore;
|
|
241
|
+
let runner = bunTest.it;
|
|
242
|
+
if (isSkip)
|
|
243
|
+
runner = (bunTest.it.skip ?? bunTest.it);
|
|
244
|
+
else if (options.only && bunTest.it.only)
|
|
245
|
+
runner = bunTest.it.only;
|
|
246
|
+
if (isSkip) {
|
|
247
|
+
runner(name, testWithEnv);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const timeout = options.timeout ?? defaultTimeout;
|
|
251
|
+
if (Number.isFinite(timeout) && timeout > 0) {
|
|
252
|
+
runner(name, { timeout }, testWithEnv);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
runner(name, testWithEnv);
|
|
256
|
+
},
|
|
257
|
+
beforeEach: bunTest.beforeEach,
|
|
258
|
+
afterEach: bunTest.afterEach,
|
|
259
|
+
beforeAll: bunTest.beforeAll,
|
|
260
|
+
afterAll: bunTest.afterAll,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
async function getImpl() {
|
|
264
|
+
if (_impl)
|
|
265
|
+
return _impl;
|
|
266
|
+
if (isBun) {
|
|
267
|
+
const importBunTest = new Function("return import('bun:test')");
|
|
268
|
+
const bunTestModule = await importBunTest();
|
|
269
|
+
_impl = createBunImpl(bunTestModule.default);
|
|
270
|
+
return _impl;
|
|
271
|
+
}
|
|
272
|
+
const importNodeTest = new Function("return import('node:test')");
|
|
273
|
+
const nodeTest = await importNodeTest();
|
|
274
|
+
_impl = createNodeImpl(nodeTest);
|
|
275
|
+
return _impl;
|
|
276
|
+
}
|
|
277
|
+
function hasOptions(options) {
|
|
278
|
+
return Object.values(options).some((v) => v !== undefined);
|
|
279
|
+
}
|
|
280
|
+
function normalizeDenoOptions(options) {
|
|
281
|
+
if (!options.skip)
|
|
282
|
+
return options;
|
|
283
|
+
const { skip: _skip, ...rest } = options;
|
|
284
|
+
return { ...rest, ignore: true };
|
|
285
|
+
}
|
|
286
|
+
function requireImpl() {
|
|
287
|
+
if (_impl)
|
|
288
|
+
return _impl;
|
|
289
|
+
throw new Error("BDD implementation not initialized. For Node/Bun, call initBdd() first, or import from #veryfront/testing which auto-initializes.");
|
|
290
|
+
}
|
|
291
|
+
function getNameAndFn(nameOrOptions, optionsOrFn, fn) {
|
|
292
|
+
const name = typeof nameOrOptions === "string" ? nameOrOptions : nameOrOptions.name;
|
|
293
|
+
const testFn = typeof optionsOrFn === "function" ? optionsOrFn : fn;
|
|
294
|
+
if (!testFn)
|
|
295
|
+
throw new Error("Missing test function");
|
|
296
|
+
return { name, testFn };
|
|
297
|
+
}
|
|
298
|
+
export function describe(nameOrOptions, optionsOrFn, fn) {
|
|
299
|
+
if (!denoBdd) {
|
|
300
|
+
requireImpl().describe(nameOrOptions, optionsOrFn, fn);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
304
|
+
if (!testFn)
|
|
305
|
+
throw new Error("describe requires a test function");
|
|
306
|
+
const denoOptions = normalizeDenoOptions(options);
|
|
307
|
+
if (hasOptions(denoOptions)) {
|
|
308
|
+
denoBdd.describe({ name, ...denoOptions }, testFn);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
denoBdd.describe(name, testFn);
|
|
312
|
+
}
|
|
313
|
+
describe.skip = function skip(nameOrOptions, optionsOrFn, fn) {
|
|
314
|
+
const { name, testFn } = getNameAndFn(nameOrOptions, optionsOrFn, fn);
|
|
315
|
+
if (denoBdd) {
|
|
316
|
+
denoBdd.describe({ name, ignore: true }, testFn);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
requireImpl().describe({ name, ignore: true }, testFn);
|
|
320
|
+
};
|
|
321
|
+
describe.ignore = describe.skip;
|
|
322
|
+
describe.only = function only(nameOrOptions, optionsOrFn, fn) {
|
|
323
|
+
const { name, testFn } = getNameAndFn(nameOrOptions, optionsOrFn, fn);
|
|
324
|
+
if (denoBdd) {
|
|
325
|
+
denoBdd.describe({ name, only: true }, testFn);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
requireImpl().describe({ name, only: true }, testFn);
|
|
329
|
+
};
|
|
330
|
+
export function it(nameOrOptions, optionsOrFn, fn) {
|
|
331
|
+
if (!denoBdd) {
|
|
332
|
+
requireImpl().it(nameOrOptions, optionsOrFn, fn);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
336
|
+
if (!testFn)
|
|
337
|
+
throw new Error("it requires a test function");
|
|
338
|
+
const testWithEnv = withEnvOverlay(testFn);
|
|
339
|
+
const denoOptions = normalizeDenoOptions(options);
|
|
340
|
+
if (hasOptions(denoOptions)) {
|
|
341
|
+
denoBdd.it({ name, ...denoOptions }, testWithEnv);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
denoBdd.it(name, testWithEnv);
|
|
345
|
+
}
|
|
346
|
+
it.skip = function skip(nameOrOptions, optionsOrFn, fn) {
|
|
347
|
+
const { name, testFn } = getNameAndFn(nameOrOptions, optionsOrFn, fn);
|
|
348
|
+
const testWithEnv = withEnvOverlay(testFn);
|
|
349
|
+
if (denoBdd) {
|
|
350
|
+
denoBdd.it({ name, ignore: true }, testWithEnv);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
requireImpl().it({ name, ignore: true }, testWithEnv);
|
|
354
|
+
};
|
|
355
|
+
it.ignore = it.skip;
|
|
356
|
+
it.only = function only(nameOrOptions, optionsOrFn, fn) {
|
|
357
|
+
const { name, testFn } = getNameAndFn(nameOrOptions, optionsOrFn, fn);
|
|
358
|
+
const testWithEnv = withEnvOverlay(testFn);
|
|
359
|
+
if (denoBdd) {
|
|
360
|
+
denoBdd.it({ name, only: true }, testWithEnv);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
requireImpl().it({ name, only: true }, testWithEnv);
|
|
364
|
+
};
|
|
365
|
+
export function beforeEach(fn) {
|
|
366
|
+
if (denoBdd) {
|
|
367
|
+
denoBdd.beforeEach(fn);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
requireImpl().beforeEach(fn);
|
|
371
|
+
}
|
|
372
|
+
export function afterEach(fn) {
|
|
373
|
+
if (denoBdd) {
|
|
374
|
+
denoBdd.afterEach(fn);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
requireImpl().afterEach(fn);
|
|
378
|
+
}
|
|
379
|
+
export function beforeAll(fn) {
|
|
380
|
+
if (denoBdd) {
|
|
381
|
+
denoBdd.beforeAll(fn);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
requireImpl().beforeAll(fn);
|
|
385
|
+
}
|
|
386
|
+
export function afterAll(fn) {
|
|
387
|
+
if (denoBdd) {
|
|
388
|
+
denoBdd.afterAll(fn);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
requireImpl().afterAll(fn);
|
|
392
|
+
}
|
|
393
|
+
export const test = it;
|
|
394
|
+
export async function initBdd() {
|
|
395
|
+
if (denoBdd)
|
|
396
|
+
return;
|
|
397
|
+
await getImpl();
|
|
398
|
+
}
|
|
399
|
+
if (!isDeno) {
|
|
400
|
+
await initBdd();
|
|
401
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { chmod, createFileSystem, exists, isAlreadyExistsError, isNotFoundError, makeTempDir, mkdir, readDir, readFile, readTextFile, remove, stat, writeFile, writeTextFile, } from "../platform/compat/fs.js";
|
|
2
|
+
export { cwd, deleteEnv, env, getArgs, getEnv, setEnv, } from "../platform/compat/process.js";
|
|
3
|
+
export declare function makeTempFile(options?: {
|
|
4
|
+
prefix?: string;
|
|
5
|
+
suffix?: string;
|
|
6
|
+
}): Promise<string>;
|
|
7
|
+
export declare function makeTempDirWithOptions(options?: {
|
|
8
|
+
prefix?: string;
|
|
9
|
+
dir?: string;
|
|
10
|
+
}): Promise<string>;
|
|
11
|
+
export declare function waitFor(condition: () => boolean | Promise<boolean>, options?: {
|
|
12
|
+
timeout?: number;
|
|
13
|
+
interval?: number;
|
|
14
|
+
message?: string;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
export declare function delay(ms: number): Promise<void>;
|
|
17
|
+
export declare function exit(code: number): never;
|
|
18
|
+
export declare function withTempDir<T>(fn: (tempDir: string) => Promise<T>, options?: {
|
|
19
|
+
prefix?: string;
|
|
20
|
+
}): Promise<T>;
|
|
21
|
+
export declare function withTempFile<T>(fn: (tempFile: string) => Promise<T>, options?: {
|
|
22
|
+
prefix?: string;
|
|
23
|
+
suffix?: string;
|
|
24
|
+
}): Promise<T>;
|
|
25
|
+
export declare function withEnv<T>(vars: Record<string, string>, fn: () => Promise<T>): Promise<T>;
|
|
26
|
+
//# sourceMappingURL=deno-compat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deno-compat.d.ts","sourceRoot":"","sources":["../../../src/src/testing/deno-compat.ts"],"names":[],"mappings":"AAsBA,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,MAAM,EACN,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,KAAK,EACL,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,SAAS,EACT,aAAa,GACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,GAAG,EACH,SAAS,EACT,GAAG,EACH,OAAO,EACP,MAAM,EACN,MAAM,GACP,MAAM,+BAA+B,CAAC;AAEvC,wBAAsB,YAAY,CAChC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7C,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,wBAAsB,sBAAsB,CAAC,OAAO,CAAC,EAAE;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBlB;AAED,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAC3C,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACA,OAAO,CAAC,IAAI,CAAC,CAaf;AAGD,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAOxC;AAED,wBAAsB,WAAW,CAAC,CAAC,EACjC,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACnC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5B,OAAO,CAAC,CAAC,CAAC,CAkBZ;AAED,wBAAsB,YAAY,CAAC,CAAC,EAClC,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACpC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7C,OAAO,CAAC,CAAC,CAAC,CAkBZ;AAED,wBAAsB,OAAO,CAAC,CAAC,EAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAuBZ"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno API compatibility shims for cross-runtime testing.
|
|
3
|
+
*
|
|
4
|
+
* Provides portable implementations of common Deno testing APIs:
|
|
5
|
+
* - Deno.makeTempDir() → makeTempDir()
|
|
6
|
+
* - Deno.makeTempFile() → makeTempFile()
|
|
7
|
+
* - Deno.writeTextFile() → writeTextFile()
|
|
8
|
+
* - Deno.readTextFile() → readTextFile()
|
|
9
|
+
* - Deno.remove() → remove()
|
|
10
|
+
* - Deno.mkdir() → mkdir()
|
|
11
|
+
* - Deno.stat() → stat()
|
|
12
|
+
* - Deno.env.get/set/delete → getEnv/setEnv/deleteEnv
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
17
|
+
import { isDeno } from "../platform/compat/runtime.js";
|
|
18
|
+
import { scaleMs } from "./timing.js";
|
|
19
|
+
import { TIMEOUT_ERROR } from "../errors/index.js";
|
|
20
|
+
export { chmod, createFileSystem, exists, isAlreadyExistsError, isNotFoundError, makeTempDir, mkdir, readDir, readFile, readTextFile, remove, stat, writeFile, writeTextFile, } from "../platform/compat/fs.js";
|
|
21
|
+
export { cwd, deleteEnv, env, getArgs, getEnv, setEnv, } from "../platform/compat/process.js";
|
|
22
|
+
export async function makeTempFile(options) {
|
|
23
|
+
if (isDeno) {
|
|
24
|
+
// @ts-ignore - Deno global
|
|
25
|
+
return await dntShim.Deno.makeTempFile(options);
|
|
26
|
+
}
|
|
27
|
+
const [{ default: os }, { default: fs }, { default: path }] = await Promise.all([
|
|
28
|
+
import("node:os"),
|
|
29
|
+
import("node:fs/promises"),
|
|
30
|
+
import("node:path"),
|
|
31
|
+
]);
|
|
32
|
+
const prefix = options?.prefix ?? "tmp-";
|
|
33
|
+
const suffix = options?.suffix ?? "";
|
|
34
|
+
const randomPart = Math.random().toString(36).substring(2, 10);
|
|
35
|
+
const filename = `${prefix}${randomPart}${suffix}`;
|
|
36
|
+
const tempPath = path.join(os.tmpdir(), filename);
|
|
37
|
+
await fs.writeFile(tempPath, "");
|
|
38
|
+
return tempPath;
|
|
39
|
+
}
|
|
40
|
+
export async function makeTempDirWithOptions(options) {
|
|
41
|
+
if (isDeno) {
|
|
42
|
+
// @ts-ignore - Deno global
|
|
43
|
+
return await dntShim.Deno.makeTempDir(options);
|
|
44
|
+
}
|
|
45
|
+
const [{ default: os }, { default: fs }, { default: path }] = await Promise.all([
|
|
46
|
+
import("node:os"),
|
|
47
|
+
import("node:fs/promises"),
|
|
48
|
+
import("node:path"),
|
|
49
|
+
]);
|
|
50
|
+
const baseDir = options?.dir ?? os.tmpdir();
|
|
51
|
+
const prefix = options?.prefix ?? "tmp-";
|
|
52
|
+
const randomPart = Math.random().toString(36).substring(2, 10);
|
|
53
|
+
const dirname = `${prefix}${randomPart}`;
|
|
54
|
+
const tempPath = path.join(baseDir, dirname);
|
|
55
|
+
await fs.mkdir(tempPath, { recursive: true });
|
|
56
|
+
return tempPath;
|
|
57
|
+
}
|
|
58
|
+
export async function waitFor(condition, options) {
|
|
59
|
+
const timeout = scaleMs(options?.timeout ?? 5000, 10);
|
|
60
|
+
const interval = scaleMs(options?.interval ?? 100, 5);
|
|
61
|
+
const message = options?.message ?? "Condition not met within timeout";
|
|
62
|
+
const start = Date.now();
|
|
63
|
+
while (Date.now() - start < timeout) {
|
|
64
|
+
if (await condition())
|
|
65
|
+
return;
|
|
66
|
+
// no cleanup needed: one-shot
|
|
67
|
+
await new Promise((resolve) => dntShim.setTimeout(resolve, interval));
|
|
68
|
+
}
|
|
69
|
+
throw TIMEOUT_ERROR.create({ detail: `${message} (timeout: ${timeout}ms)` });
|
|
70
|
+
}
|
|
71
|
+
// no cleanup needed: one-shot
|
|
72
|
+
export function delay(ms) {
|
|
73
|
+
return new Promise((resolve) => dntShim.setTimeout(resolve, scaleMs(ms)));
|
|
74
|
+
}
|
|
75
|
+
export function exit(code) {
|
|
76
|
+
if (isDeno) {
|
|
77
|
+
// @ts-ignore - Deno global
|
|
78
|
+
dntShim.Deno.exit(code);
|
|
79
|
+
}
|
|
80
|
+
process.exit(code);
|
|
81
|
+
}
|
|
82
|
+
export async function withTempDir(fn, options) {
|
|
83
|
+
const tempDir = await makeTempDirWithOptions({ prefix: options?.prefix ?? "test-" });
|
|
84
|
+
try {
|
|
85
|
+
return await fn(tempDir);
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
try {
|
|
89
|
+
if (isDeno) {
|
|
90
|
+
// @ts-ignore - Deno global
|
|
91
|
+
await dntShim.Deno.remove(tempDir, { recursive: true });
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
const { default: fs } = await import("node:fs/promises");
|
|
95
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (_) {
|
|
99
|
+
/* expected: temp dir may already be removed or inaccessible */
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export async function withTempFile(fn, options) {
|
|
104
|
+
const tempFile = await makeTempFile({ prefix: options?.prefix, suffix: options?.suffix });
|
|
105
|
+
try {
|
|
106
|
+
return await fn(tempFile);
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
try {
|
|
110
|
+
if (isDeno) {
|
|
111
|
+
// @ts-ignore - Deno global
|
|
112
|
+
await dntShim.Deno.remove(tempFile);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const { default: fs } = await import("node:fs/promises");
|
|
116
|
+
await fs.rm(tempFile, { force: true });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (_) {
|
|
120
|
+
/* expected: temp file may already be removed or inaccessible */
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export async function withEnv(vars, fn) {
|
|
125
|
+
const { getEnv, setEnv, deleteEnv } = await import("../platform/compat/process.js");
|
|
126
|
+
const original = {};
|
|
127
|
+
for (const key of Object.keys(vars)) {
|
|
128
|
+
original[key] = getEnv(key);
|
|
129
|
+
}
|
|
130
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
131
|
+
setEnv(key, value);
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
return await fn();
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
for (const [key, value] of Object.entries(original)) {
|
|
138
|
+
if (value === undefined) {
|
|
139
|
+
deleteEnv(key);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
setEnv(key, value);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-runtime test utilities — BDD framework (describe/it), assertions,
|
|
3
|
+
* test isolation, filesystem/env helpers, and timing utilities for Deno, Node, and Bun.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { assertEquals, describe, it } from "veryfront/testing";
|
|
8
|
+
*
|
|
9
|
+
* describe("math", () => {
|
|
10
|
+
* it("adds numbers", () => {
|
|
11
|
+
* assertEquals(1 + 1, 2);
|
|
12
|
+
* });
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @module testing
|
|
17
|
+
*/
|
|
18
|
+
import "../../_dnt.polyfills.js";
|
|
19
|
+
import "./init.js";
|
|
20
|
+
export { assert, assertEquals, assertExists, assertGreater, assertGreaterOrEqual, assertInstanceOf, assertLess, assertLessOrEqual, assertMatch, assertNotEquals, assertNotStrictEquals, assertObjectMatch, assertRejects, assertStrictEquals, assertStringIncludes, assertThrows, fail, } from "./assert.js";
|
|
21
|
+
export { deepEquals, safeStringify } from "./utils.js";
|
|
22
|
+
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, test, } from "./bdd.js";
|
|
23
|
+
export type { BddTestContext, TestOptions } from "./bdd.js";
|
|
24
|
+
export { registerTestCleanup, resetAllTestState } from "./isolation.js";
|
|
25
|
+
export { chmod, createFileSystem, cwd, delay, deleteEnv, env, exists, exit, getArgs, getEnv, isAlreadyExistsError, isNotFoundError, makeTempDir, makeTempDirWithOptions, makeTempFile, mkdir, readDir, readFile, readTextFile, remove, setEnv, stat, waitFor, withEnv, withTempDir, withTempFile, writeFile, writeTextFile, } from "./deno-compat.js";
|
|
26
|
+
export { getTestTimeScale, scaleMs, testDelay } from "./timing.js";
|
|
27
|
+
export { isBun, isDeno, isNode } from "../platform/compat/runtime.js";
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,yBAAyB,CAAC;AAEjC,OAAO,WAAW,CAAC;AAEnB,OAAO,EACL,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,IAAI,GACL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EACL,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,EAAE,EACF,IAAI,GACL,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,GAAG,EACH,KAAK,EACL,SAAS,EACT,GAAG,EACH,MAAM,EACN,IAAI,EACJ,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,YAAY,EACZ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,GACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-runtime test utilities — BDD framework (describe/it), assertions,
|
|
3
|
+
* test isolation, filesystem/env helpers, and timing utilities for Deno, Node, and Bun.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { assertEquals, describe, it } from "veryfront/testing";
|
|
8
|
+
*
|
|
9
|
+
* describe("math", () => {
|
|
10
|
+
* it("adds numbers", () => {
|
|
11
|
+
* assertEquals(1 + 1, 2);
|
|
12
|
+
* });
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @module testing
|
|
17
|
+
*/
|
|
18
|
+
// Initialize test environment before any other imports
|
|
19
|
+
import "../../_dnt.polyfills.js";
|
|
20
|
+
import "./init.js";
|
|
21
|
+
export { assert, assertEquals, assertExists, assertGreater, assertGreaterOrEqual, assertInstanceOf, assertLess, assertLessOrEqual, assertMatch, assertNotEquals, assertNotStrictEquals, assertObjectMatch, assertRejects, assertStrictEquals, assertStringIncludes, assertThrows, fail, } from "./assert.js";
|
|
22
|
+
export { deepEquals, safeStringify } from "./utils.js";
|
|
23
|
+
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, test, } from "./bdd.js";
|
|
24
|
+
export { registerTestCleanup, resetAllTestState } from "./isolation.js";
|
|
25
|
+
export { chmod, createFileSystem, cwd, delay, deleteEnv, env, exists, exit, getArgs, getEnv, isAlreadyExistsError, isNotFoundError, makeTempDir, makeTempDirWithOptions, makeTempFile, mkdir, readDir, readFile, readTextFile, remove, setEnv, stat, waitFor, withEnv, withTempDir, withTempFile, writeFile, writeTextFile, } from "./deno-compat.js";
|
|
26
|
+
export { getTestTimeScale, scaleMs, testDelay } from "./timing.js";
|
|
27
|
+
export { isBun, isDeno, isNode } from "../platform/compat/runtime.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/src/testing/init.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test environment initialization.
|
|
3
|
+
*
|
|
4
|
+
* This module sets up the testing environment by disabling features
|
|
5
|
+
* that can cause resource leaks in tests, like LRU cache cleanup intervals.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: Import this module before any other veryfront imports in test files
|
|
8
|
+
* to ensure the flags are set before module-level caches are initialized.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
13
|
+
const g = dntShim.dntGlobalThis;
|
|
14
|
+
g.__vfDisableLruInterval = true;
|
|
15
|
+
g.__vfTestEnv = true;
|
|
16
|
+
g.__vfTestEnvMask = {
|
|
17
|
+
prefixes: ["VERYFRONT_", "OTEL_", "OAUTH_", "GITHUB_", "OPENAI_", "ANTHROPIC_", "GOOGLE_"],
|
|
18
|
+
};
|