veryfront 0.1.324 → 0.1.327
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/hosted-child-fork-stream-execution.d.ts +130 -0
- package/esm/src/agent/hosted-child-fork-stream-execution.d.ts.map +1 -0
- package/esm/src/agent/hosted-child-fork-stream-execution.js +391 -0
- package/esm/src/agent/index.d.ts +2 -0
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +2 -0
- package/esm/src/chat/conversation.d.ts +5 -5
- package/esm/src/chat/final-step-fallback.js +2 -2
- 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.14/global.d.ts +166 -0
- package/src/deps/esm.sh/@types/react@19.2.14/index.d.ts +4370 -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/hosted-child-fork-stream-execution.ts +579 -0
- package/src/src/agent/index.ts +26 -0
- package/src/src/chat/final-step-fallback.ts +2 -2
- 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,618 @@
|
|
|
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
|
+
|
|
12
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import { isBun, isDeno } from "../platform/compat/runtime.js";
|
|
16
|
+
import { getEnvOverlayStorage } from "../platform/compat/process.js";
|
|
17
|
+
|
|
18
|
+
/** Test function that can be sync or async */
|
|
19
|
+
type TestFn = () => void | Promise<void>;
|
|
20
|
+
|
|
21
|
+
/** Test options for Deno sanitizers (ignored in Node/Bun) */
|
|
22
|
+
export interface TestOptions {
|
|
23
|
+
sanitizeResources?: boolean;
|
|
24
|
+
sanitizeOps?: boolean;
|
|
25
|
+
sanitizeExit?: boolean;
|
|
26
|
+
skip?: boolean;
|
|
27
|
+
only?: boolean;
|
|
28
|
+
ignore?: boolean;
|
|
29
|
+
timeout?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Context passed to hooks and tests (BDD-specific) */
|
|
33
|
+
export interface BddTestContext {
|
|
34
|
+
name: string;
|
|
35
|
+
origin?: string;
|
|
36
|
+
parent?: BddTestContext;
|
|
37
|
+
step?: (name: string, fn: TestFn) => Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Hook function */
|
|
41
|
+
type HookFn = (ctx?: BddTestContext) => void | Promise<void>;
|
|
42
|
+
|
|
43
|
+
type EnvOverlayStorageShim = {
|
|
44
|
+
storage: {
|
|
45
|
+
getStore: () => unknown;
|
|
46
|
+
run?: <T>(store: unknown, fn: () => T) => T;
|
|
47
|
+
enterWith?: (store: unknown) => void;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type EnvOverlayValue = string | null;
|
|
52
|
+
type EnvOverlayStore = Map<string, EnvOverlayValue>;
|
|
53
|
+
|
|
54
|
+
type DenoEnvFacade = {
|
|
55
|
+
get: (key: string) => string | undefined;
|
|
56
|
+
set: (key: string, value: string) => void;
|
|
57
|
+
delete: (key: string) => void;
|
|
58
|
+
has: (key: string) => boolean;
|
|
59
|
+
toObject: () => Record<string, string>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
function getActiveEnvOverlay(): EnvOverlayStore | null {
|
|
63
|
+
const storage = getEnvOverlayStorage();
|
|
64
|
+
const store = storage?.getStore();
|
|
65
|
+
return store instanceof Map ? store as EnvOverlayStore : null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function applyEnvOverlay(
|
|
69
|
+
base: Record<string, string>,
|
|
70
|
+
overlay: EnvOverlayStore | null,
|
|
71
|
+
): Record<string, string> {
|
|
72
|
+
if (!overlay) return { ...base };
|
|
73
|
+
|
|
74
|
+
const merged = { ...base };
|
|
75
|
+
for (const [key, value] of overlay.entries()) {
|
|
76
|
+
if (value === null) {
|
|
77
|
+
delete merged[key];
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
merged[key] = value;
|
|
81
|
+
}
|
|
82
|
+
return merged;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function installDenoEnvOverlayFacade(): void {
|
|
86
|
+
if (!isDeno || typeof dntShim.Deno === "undefined" || typeof dntShim.Deno.env === "undefined") return;
|
|
87
|
+
|
|
88
|
+
const globalAny = dntShim.dntGlobalThis as Record<string, unknown>;
|
|
89
|
+
if (globalAny["__vfTestDenoEnvOverlayFacadeInstalled"]) return;
|
|
90
|
+
globalAny["__vfTestDenoEnvOverlayFacadeInstalled"] = true;
|
|
91
|
+
|
|
92
|
+
const originalDenoEnv = {
|
|
93
|
+
get: dntShim.Deno.env.get.bind(dntShim.Deno.env),
|
|
94
|
+
set: dntShim.Deno.env.set.bind(dntShim.Deno.env),
|
|
95
|
+
delete: dntShim.Deno.env.delete.bind(dntShim.Deno.env),
|
|
96
|
+
has: dntShim.Deno.env.has.bind(dntShim.Deno.env),
|
|
97
|
+
toObject: dntShim.Deno.env.toObject.bind(dntShim.Deno.env),
|
|
98
|
+
} satisfies DenoEnvFacade;
|
|
99
|
+
|
|
100
|
+
dntShim.Deno.env.get = (key: string): string | undefined => {
|
|
101
|
+
const overlay = getActiveEnvOverlay();
|
|
102
|
+
if (overlay?.has(key)) return overlay.get(key) ?? undefined;
|
|
103
|
+
return originalDenoEnv.get(key);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
dntShim.Deno.env.set = (key: string, value: string): void => {
|
|
107
|
+
const overlay = getActiveEnvOverlay();
|
|
108
|
+
if (overlay) {
|
|
109
|
+
overlay.set(key, value);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
originalDenoEnv.set(key, value);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
dntShim.Deno.env.delete = (key: string): void => {
|
|
116
|
+
const overlay = getActiveEnvOverlay();
|
|
117
|
+
if (overlay) {
|
|
118
|
+
overlay.set(key, null);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
originalDenoEnv.delete(key);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
dntShim.Deno.env.has = (key: string): boolean => {
|
|
125
|
+
const overlay = getActiveEnvOverlay();
|
|
126
|
+
if (overlay?.has(key)) return overlay.get(key) !== null;
|
|
127
|
+
return originalDenoEnv.has(key);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
dntShim.Deno.env.toObject = (): Record<string, string> => {
|
|
131
|
+
return applyEnvOverlay(originalDenoEnv.toObject(), getActiveEnvOverlay());
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const processAny = globalAny["process"] as
|
|
135
|
+
| { env?: Record<string, string | undefined> }
|
|
136
|
+
| undefined;
|
|
137
|
+
if (!processAny?.env) return;
|
|
138
|
+
|
|
139
|
+
const baseProcessEnv = processAny.env;
|
|
140
|
+
processAny.env = new Proxy(baseProcessEnv, {
|
|
141
|
+
get(target, prop, receiver) {
|
|
142
|
+
if (typeof prop !== "string") return Reflect.get(target, prop, receiver);
|
|
143
|
+
return dntShim.Deno.env.get(prop);
|
|
144
|
+
},
|
|
145
|
+
set(target, prop, value, receiver) {
|
|
146
|
+
if (typeof prop !== "string") return Reflect.set(target, prop, value, receiver);
|
|
147
|
+
dntShim.Deno.env.set(prop, String(value));
|
|
148
|
+
return true;
|
|
149
|
+
},
|
|
150
|
+
deleteProperty(target, prop) {
|
|
151
|
+
if (typeof prop !== "string") return Reflect.deleteProperty(target, prop);
|
|
152
|
+
dntShim.Deno.env.delete(prop);
|
|
153
|
+
return true;
|
|
154
|
+
},
|
|
155
|
+
has(target, prop) {
|
|
156
|
+
if (typeof prop !== "string") return Reflect.has(target, prop);
|
|
157
|
+
return dntShim.Deno.env.has(prop);
|
|
158
|
+
},
|
|
159
|
+
ownKeys() {
|
|
160
|
+
return Object.keys(dntShim.Deno.env.toObject());
|
|
161
|
+
},
|
|
162
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
163
|
+
if (typeof prop !== "string") return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
164
|
+
const value = dntShim.Deno.env.get(prop);
|
|
165
|
+
if (value === undefined) return undefined;
|
|
166
|
+
return {
|
|
167
|
+
configurable: true,
|
|
168
|
+
enumerable: true,
|
|
169
|
+
writable: true,
|
|
170
|
+
value,
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async function installDenoEnvOverlayStorage(): Promise<void> {
|
|
177
|
+
if (!isDeno) return;
|
|
178
|
+
|
|
179
|
+
const globalAny = dntShim.dntGlobalThis as Record<string, unknown>;
|
|
180
|
+
if (!globalAny["__vfTestDenoEnvOverlay"]) {
|
|
181
|
+
const { AsyncLocalStorage } = await import("node:async_hooks");
|
|
182
|
+
const storage = new AsyncLocalStorage<EnvOverlayStore>();
|
|
183
|
+
|
|
184
|
+
globalAny["__vfTestDenoEnvOverlay"] = {
|
|
185
|
+
storage: {
|
|
186
|
+
getStore: () => storage.getStore(),
|
|
187
|
+
run: <T>(store: unknown, fn: () => T) => storage.run(store as EnvOverlayStore, fn),
|
|
188
|
+
enterWith: (store: unknown) => storage.enterWith(store as EnvOverlayStore),
|
|
189
|
+
},
|
|
190
|
+
} satisfies EnvOverlayStorageShim;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
installDenoEnvOverlayFacade();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function withEnvOverlay<T extends TestFn | (() => void)>(fn: T): T {
|
|
197
|
+
const overlay = getEnvOverlayStorage();
|
|
198
|
+
if (!overlay) return fn;
|
|
199
|
+
|
|
200
|
+
return ((...args: unknown[]) => {
|
|
201
|
+
if (overlay.run) {
|
|
202
|
+
return overlay.run(
|
|
203
|
+
new Map<string, string | null>(),
|
|
204
|
+
() => Promise.resolve().then(() => fn(...(args as []))),
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (overlay.enterWith) {
|
|
209
|
+
overlay.enterWith(new Map<string, string | null>());
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return fn(...(args as []));
|
|
213
|
+
}) as T;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// For Deno, we directly use @std/testing/bdd - no wrapper needed
|
|
217
|
+
// This avoids creating a "global" test suite from top-level await
|
|
218
|
+
let denoBdd: typeof import("../../deps/jsr.io/@std/testing/1.0.18/bdd.js") | null = null;
|
|
219
|
+
|
|
220
|
+
if (isDeno) {
|
|
221
|
+
await installDenoEnvOverlayStorage();
|
|
222
|
+
denoBdd = await import("../../deps/jsr.io/@std/testing/1.0.18/bdd.js");
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
interface BddImpl {
|
|
226
|
+
describe(
|
|
227
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
228
|
+
optionsOrFn?: TestOptions | (() => void),
|
|
229
|
+
fn?: () => void,
|
|
230
|
+
): void;
|
|
231
|
+
it(
|
|
232
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
233
|
+
optionsOrFn?: TestOptions | TestFn,
|
|
234
|
+
fn?: TestFn,
|
|
235
|
+
): void;
|
|
236
|
+
beforeEach(fn: HookFn): void;
|
|
237
|
+
afterEach(fn: HookFn): void;
|
|
238
|
+
beforeAll(fn: HookFn): void;
|
|
239
|
+
afterAll(fn: HookFn): void;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
let _impl: BddImpl | null = null;
|
|
243
|
+
|
|
244
|
+
function parseBddArgs<T extends TestFn | (() => void)>(
|
|
245
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
246
|
+
optionsOrFn?: TestOptions | T,
|
|
247
|
+
fn?: T,
|
|
248
|
+
): { name: string; options: TestOptions; testFn: T | undefined } {
|
|
249
|
+
const name = typeof nameOrOptions === "string" ? nameOrOptions : nameOrOptions.name;
|
|
250
|
+
|
|
251
|
+
let options: TestOptions = {};
|
|
252
|
+
if (typeof nameOrOptions === "object") {
|
|
253
|
+
options = nameOrOptions;
|
|
254
|
+
} else if (typeof optionsOrFn === "object" && typeof optionsOrFn !== "function") {
|
|
255
|
+
options = optionsOrFn;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const testFn = typeof optionsOrFn === "function" ? optionsOrFn : fn;
|
|
259
|
+
return { name, options, testFn };
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function createNodeImpl(nodeTest: {
|
|
263
|
+
describe: ((name: string, fn: () => void) => void) & {
|
|
264
|
+
skip: (name: string, fn: () => void) => void;
|
|
265
|
+
only?: (name: string, fn: () => void) => void;
|
|
266
|
+
};
|
|
267
|
+
it: ((name: string, optionsOrFn: { timeout?: number } | TestFn, fn?: TestFn) => void) & {
|
|
268
|
+
skip: (name: string, fn: TestFn) => void;
|
|
269
|
+
only?: (name: string, fn: TestFn) => void;
|
|
270
|
+
};
|
|
271
|
+
before: (fn: HookFn) => void;
|
|
272
|
+
after: (fn: HookFn) => void;
|
|
273
|
+
beforeEach: (fn: HookFn) => void;
|
|
274
|
+
afterEach: (fn: HookFn) => void;
|
|
275
|
+
}): BddImpl {
|
|
276
|
+
return {
|
|
277
|
+
describe(nameOrOptions, optionsOrFn, fn): void {
|
|
278
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
279
|
+
if (!testFn) throw new Error("describe requires a test function");
|
|
280
|
+
|
|
281
|
+
if (options.skip || options.ignore) {
|
|
282
|
+
nodeTest.describe.skip(name, testFn);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (options.only && nodeTest.describe.only) {
|
|
287
|
+
nodeTest.describe.only(name, testFn);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
nodeTest.describe(name, testFn);
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
it(nameOrOptions, optionsOrFn, fn): void {
|
|
295
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
296
|
+
if (!testFn) throw new Error("it requires a test function");
|
|
297
|
+
|
|
298
|
+
if (options.skip || options.ignore) {
|
|
299
|
+
nodeTest.it.skip(name, testFn);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (options.only && nodeTest.it.only) {
|
|
304
|
+
nodeTest.it.only(name, testFn);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (options.timeout !== undefined) {
|
|
309
|
+
nodeTest.it(name, { timeout: options.timeout }, testFn);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
nodeTest.it(name, testFn);
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
beforeEach: nodeTest.beforeEach,
|
|
317
|
+
afterEach: nodeTest.afterEach,
|
|
318
|
+
beforeAll: nodeTest.before,
|
|
319
|
+
afterAll: nodeTest.after,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
interface BunTestModule {
|
|
324
|
+
describe: ((name: string, fn: () => void) => void) & {
|
|
325
|
+
skip?: (name: string, fn: () => void) => void;
|
|
326
|
+
only?: (name: string, fn: () => void) => void;
|
|
327
|
+
};
|
|
328
|
+
it: ((name: string, optionsOrFn: { timeout?: number } | TestFn, fn?: TestFn) => void) & {
|
|
329
|
+
skip?: (name: string, fn: TestFn) => void;
|
|
330
|
+
only?: (name: string, fn: TestFn) => void;
|
|
331
|
+
};
|
|
332
|
+
beforeEach: (fn: HookFn) => void;
|
|
333
|
+
afterEach: (fn: HookFn) => void;
|
|
334
|
+
beforeAll: (fn: HookFn) => void;
|
|
335
|
+
afterAll: (fn: HookFn) => void;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function createBunImpl(bunTest: BunTestModule): BddImpl {
|
|
339
|
+
const defaultTimeout = (() => {
|
|
340
|
+
const env = (dntShim.dntGlobalThis as Record<string, unknown>).process as
|
|
341
|
+
| { env?: Record<string, string | undefined> }
|
|
342
|
+
| undefined;
|
|
343
|
+
const raw = env?.env?.BUN_TEST_TIMEOUT ?? env?.env?.VF_TEST_TIMEOUT ?? "30000";
|
|
344
|
+
const parsed = Number(raw);
|
|
345
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 30000;
|
|
346
|
+
})();
|
|
347
|
+
|
|
348
|
+
return {
|
|
349
|
+
describe(nameOrOptions, optionsOrFn, fn): void {
|
|
350
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
351
|
+
if (!testFn) throw new Error("describe requires a test function");
|
|
352
|
+
|
|
353
|
+
if ((options.skip || options.ignore) && bunTest.describe.skip) {
|
|
354
|
+
bunTest.describe.skip(name, testFn);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
if (options.only && bunTest.describe.only) {
|
|
359
|
+
bunTest.describe.only(name, testFn);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
bunTest.describe(name, testFn);
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
it(nameOrOptions, optionsOrFn, fn): void {
|
|
367
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
368
|
+
if (!testFn) throw new Error("it requires a test function");
|
|
369
|
+
|
|
370
|
+
const testWithEnv = withEnvOverlay(testFn);
|
|
371
|
+
const isSkip = options.skip || options.ignore;
|
|
372
|
+
|
|
373
|
+
type TestRunner = (
|
|
374
|
+
name: string,
|
|
375
|
+
optionsOrFn: { timeout?: number } | TestFn,
|
|
376
|
+
fn?: TestFn,
|
|
377
|
+
) => void;
|
|
378
|
+
|
|
379
|
+
let runner: TestRunner = bunTest.it;
|
|
380
|
+
if (isSkip) runner = (bunTest.it.skip ?? bunTest.it) as TestRunner;
|
|
381
|
+
else if (options.only && bunTest.it.only) runner = bunTest.it.only as TestRunner;
|
|
382
|
+
|
|
383
|
+
if (isSkip) {
|
|
384
|
+
runner(name, testWithEnv);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const timeout = options.timeout ?? defaultTimeout;
|
|
389
|
+
if (Number.isFinite(timeout) && timeout > 0) {
|
|
390
|
+
runner(name, { timeout }, testWithEnv);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
runner(name, testWithEnv);
|
|
395
|
+
},
|
|
396
|
+
|
|
397
|
+
beforeEach: bunTest.beforeEach,
|
|
398
|
+
afterEach: bunTest.afterEach,
|
|
399
|
+
beforeAll: bunTest.beforeAll,
|
|
400
|
+
afterAll: bunTest.afterAll,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
async function getImpl(): Promise<BddImpl> {
|
|
405
|
+
if (_impl) return _impl;
|
|
406
|
+
|
|
407
|
+
if (isBun) {
|
|
408
|
+
const importBunTest = new Function("return import('bun:test')") as () => Promise<{
|
|
409
|
+
default: BunTestModule;
|
|
410
|
+
}>;
|
|
411
|
+
const bunTestModule = await importBunTest();
|
|
412
|
+
_impl = createBunImpl(bunTestModule.default);
|
|
413
|
+
return _impl;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const importNodeTest = new Function("return import('node:test')") as () => Promise<unknown>;
|
|
417
|
+
const nodeTest = await importNodeTest();
|
|
418
|
+
_impl = createNodeImpl(
|
|
419
|
+
nodeTest as {
|
|
420
|
+
describe: ((name: string, fn: () => void) => void) & {
|
|
421
|
+
skip: (name: string, fn: () => void) => void;
|
|
422
|
+
only?: (name: string, fn: () => void) => void;
|
|
423
|
+
};
|
|
424
|
+
it: ((name: string, optionsOrFn: { timeout?: number } | TestFn, fn?: TestFn) => void) & {
|
|
425
|
+
skip: (name: string, fn: TestFn) => void;
|
|
426
|
+
only?: (name: string, fn: TestFn) => void;
|
|
427
|
+
};
|
|
428
|
+
before: (fn: HookFn) => void;
|
|
429
|
+
after: (fn: HookFn) => void;
|
|
430
|
+
beforeEach: (fn: HookFn) => void;
|
|
431
|
+
afterEach: (fn: HookFn) => void;
|
|
432
|
+
},
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
return _impl;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function hasOptions(options: TestOptions): boolean {
|
|
439
|
+
return Object.values(options).some((v) => v !== undefined);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function normalizeDenoOptions(options: TestOptions): TestOptions {
|
|
443
|
+
if (!options.skip) return options;
|
|
444
|
+
const { skip: _skip, ...rest } = options;
|
|
445
|
+
return { ...rest, ignore: true };
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function requireImpl(): BddImpl {
|
|
449
|
+
if (_impl) return _impl;
|
|
450
|
+
throw new Error(
|
|
451
|
+
"BDD implementation not initialized. For Node/Bun, call initBdd() first, or import from #veryfront/testing which auto-initializes.",
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function getNameAndFn<T extends TestFn | (() => void)>(
|
|
456
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
457
|
+
optionsOrFn?: TestOptions | T,
|
|
458
|
+
fn?: T,
|
|
459
|
+
): { name: string; testFn: T } {
|
|
460
|
+
const name = typeof nameOrOptions === "string" ? nameOrOptions : nameOrOptions.name;
|
|
461
|
+
const testFn = typeof optionsOrFn === "function" ? optionsOrFn : fn;
|
|
462
|
+
if (!testFn) throw new Error("Missing test function");
|
|
463
|
+
return { name, testFn };
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export function describe(
|
|
467
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
468
|
+
optionsOrFn?: TestOptions | (() => void),
|
|
469
|
+
fn?: () => void,
|
|
470
|
+
): void {
|
|
471
|
+
if (!denoBdd) {
|
|
472
|
+
requireImpl().describe(nameOrOptions, optionsOrFn, fn);
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
477
|
+
if (!testFn) throw new Error("describe requires a test function");
|
|
478
|
+
|
|
479
|
+
const denoOptions = normalizeDenoOptions(options);
|
|
480
|
+
if (hasOptions(denoOptions)) {
|
|
481
|
+
denoBdd.describe({ name, ...denoOptions }, testFn);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
denoBdd.describe(name, testFn);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
describe.skip = function skip(
|
|
489
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
490
|
+
optionsOrFn?: TestOptions | (() => void),
|
|
491
|
+
fn?: () => void,
|
|
492
|
+
): void {
|
|
493
|
+
const { name, testFn } = getNameAndFn(nameOrOptions, optionsOrFn, fn);
|
|
494
|
+
|
|
495
|
+
if (denoBdd) {
|
|
496
|
+
denoBdd.describe({ name, ignore: true }, testFn);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
requireImpl().describe({ name, ignore: true }, testFn);
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
describe.ignore = describe.skip;
|
|
504
|
+
|
|
505
|
+
describe.only = function only(
|
|
506
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
507
|
+
optionsOrFn?: TestOptions | (() => void),
|
|
508
|
+
fn?: () => void,
|
|
509
|
+
): void {
|
|
510
|
+
const { name, testFn } = getNameAndFn(nameOrOptions, optionsOrFn, fn);
|
|
511
|
+
|
|
512
|
+
if (denoBdd) {
|
|
513
|
+
denoBdd.describe({ name, only: true }, testFn);
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
requireImpl().describe({ name, only: true }, testFn);
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
export function it(
|
|
521
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
522
|
+
optionsOrFn?: TestOptions | TestFn,
|
|
523
|
+
fn?: TestFn,
|
|
524
|
+
): void {
|
|
525
|
+
if (!denoBdd) {
|
|
526
|
+
requireImpl().it(nameOrOptions, optionsOrFn, fn);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const { name, options, testFn } = parseBddArgs(nameOrOptions, optionsOrFn, fn);
|
|
531
|
+
if (!testFn) throw new Error("it requires a test function");
|
|
532
|
+
const testWithEnv = withEnvOverlay(testFn);
|
|
533
|
+
|
|
534
|
+
const denoOptions = normalizeDenoOptions(options);
|
|
535
|
+
if (hasOptions(denoOptions)) {
|
|
536
|
+
denoBdd.it({ name, ...denoOptions }, testWithEnv);
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
denoBdd.it(name, testWithEnv);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
it.skip = function skip(
|
|
544
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
545
|
+
optionsOrFn?: TestOptions | TestFn,
|
|
546
|
+
fn?: TestFn,
|
|
547
|
+
): void {
|
|
548
|
+
const { name, testFn } = getNameAndFn(nameOrOptions, optionsOrFn, fn);
|
|
549
|
+
const testWithEnv = withEnvOverlay(testFn);
|
|
550
|
+
|
|
551
|
+
if (denoBdd) {
|
|
552
|
+
denoBdd.it({ name, ignore: true }, testWithEnv);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
requireImpl().it({ name, ignore: true }, testWithEnv);
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
it.ignore = it.skip;
|
|
560
|
+
|
|
561
|
+
it.only = function only(
|
|
562
|
+
nameOrOptions: string | (TestOptions & { name: string }),
|
|
563
|
+
optionsOrFn?: TestOptions | TestFn,
|
|
564
|
+
fn?: TestFn,
|
|
565
|
+
): void {
|
|
566
|
+
const { name, testFn } = getNameAndFn(nameOrOptions, optionsOrFn, fn);
|
|
567
|
+
const testWithEnv = withEnvOverlay(testFn);
|
|
568
|
+
|
|
569
|
+
if (denoBdd) {
|
|
570
|
+
denoBdd.it({ name, only: true }, testWithEnv);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
requireImpl().it({ name, only: true }, testWithEnv);
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
export function beforeEach(fn: HookFn): void {
|
|
578
|
+
if (denoBdd) {
|
|
579
|
+
denoBdd.beforeEach(fn);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
requireImpl().beforeEach(fn);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export function afterEach(fn: HookFn): void {
|
|
586
|
+
if (denoBdd) {
|
|
587
|
+
denoBdd.afterEach(fn);
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
requireImpl().afterEach(fn);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export function beforeAll(fn: HookFn): void {
|
|
594
|
+
if (denoBdd) {
|
|
595
|
+
denoBdd.beforeAll(fn);
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
requireImpl().beforeAll(fn);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export function afterAll(fn: HookFn): void {
|
|
602
|
+
if (denoBdd) {
|
|
603
|
+
denoBdd.afterAll(fn);
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
requireImpl().afterAll(fn);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export const test = it;
|
|
610
|
+
|
|
611
|
+
export async function initBdd(): Promise<void> {
|
|
612
|
+
if (denoBdd) return;
|
|
613
|
+
await getImpl();
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
if (!isDeno) {
|
|
617
|
+
await initBdd();
|
|
618
|
+
}
|