aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/test_scope_debug.ts
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-30 00:25:28 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-30 00:25:28 -0700
commitc30346cf5dec0aa943d8abcdc436c53cd1ef49e3 (patch)
treee769b20dac0971b5692c219984503be2154c4bcf /test/bun.js/test_scope_debug.ts
parent64ef2389dcedac599b131165c27929143131e937 (diff)
downloadbun-c30346cf5dec0aa943d8abcdc436c53cd1ef49e3.tar.gz
bun-c30346cf5dec0aa943d8abcdc436c53cd1ef49e3.tar.zst
bun-c30346cf5dec0aa943d8abcdc436c53cd1ef49e3.zip
Create test_scope_debug.ts
Diffstat (limited to 'test/bun.js/test_scope_debug.ts')
-rw-r--r--test/bun.js/test_scope_debug.ts62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/bun.js/test_scope_debug.ts b/test/bun.js/test_scope_debug.ts
new file mode 100644
index 000000000..c1bb6c9fa
--- /dev/null
+++ b/test/bun.js/test_scope_debug.ts
@@ -0,0 +1,62 @@
+export function wrap({ test: test_, it: it_, describe: describe_ }) {
+ if (it_ === undefined) {
+ it_ = test_;
+ }
+
+ var describe = (label, cb) => {
+ return describe_(
+ label,
+ cb instanceof async function () {}.constructor
+ ? async () => {
+ console.log(`DESCRIBE [Enter] ${label}`);
+ try {
+ return await cb();
+ } catch (e) {
+ throw e;
+ } finally {
+ console.log(`DESCRIBE [Exit] ${label}`);
+ }
+ }
+ : () => {
+ console.log(`DESCRIBE [Enter] ${label}`);
+ try {
+ return cb();
+ } catch (e) {
+ throw e;
+ } finally {
+ console.log(`DESCRIBE [Exit] ${label}`);
+ }
+ }
+ );
+ };
+
+ var it = (label, cb) => {
+ console.log("Before", label);
+ return it_(
+ label,
+ cb instanceof async function () {}.constructor
+ ? async () => {
+ console.log(`TEST [Enter] ${label}`);
+ try {
+ return await cb();
+ } catch (e) {
+ throw e;
+ } finally {
+ console.log(`TEST [Exit] ${label}`);
+ }
+ }
+ : () => {
+ console.log(`TEST [Enter] ${label}`);
+ try {
+ return cb();
+ } catch (e) {
+ throw e;
+ } finally {
+ console.log(`TEST [Exit] ${label}`);
+ }
+ }
+ );
+ };
+
+ return { describe, it };
+}