aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/test_scope_debug.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/bun.js/test_scope_debug.ts')
-rw-r--r--test/bun.js/test_scope_debug.ts172
1 files changed, 0 insertions, 172 deletions
diff --git a/test/bun.js/test_scope_debug.ts b/test/bun.js/test_scope_debug.ts
deleted file mode 100644
index fbc79acd8..000000000
--- a/test/bun.js/test_scope_debug.ts
+++ /dev/null
@@ -1,172 +0,0 @@
-type AnyFunction = (...args: any[]) => any;
-export function wrap({
- test: test_,
- it: it_,
- describe: describe_,
- beforeEach: beforeEach_ = undefined,
- beforeAll: beforeAll_ = undefined,
- afterEach: afterEach_ = undefined,
- afterAll: afterAll_ = undefined,
-}: any) {
- if (it_ === undefined) {
- it_ = test_;
- }
-
- var describe = (label, cb: AnyFunction) => {
- 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: AnyFunction) => {
- 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}`);
- }
- },
- );
- };
-
- var beforeEach = (cb: AnyFunction) => {
- return beforeEach_(
- cb instanceof async function () {}.constructor
- ? async () => {
- console.log(`BEFORE EACH [Enter]`);
- try {
- return await cb();
- } catch (e) {
- throw e;
- } finally {
- console.log(`BEFORE EACH [Exit]`);
- }
- }
- : () => {
- console.log(`BEFORE EACH [Enter]`);
- try {
- return cb();
- } catch (e) {
- throw e;
- } finally {
- console.log(`BEFORE EACH [Exit]`);
- }
- },
- );
- };
- var beforeAll = (cb: AnyFunction) => {
- return beforeAll_(
- cb instanceof async function () {}.constructor
- ? async () => {
- console.log(`BEFORE ALL [Enter]`);
- try {
- return await cb();
- } catch (e) {
- throw e;
- } finally {
- console.log(`BEFORE ALL [Exit]`);
- }
- }
- : () => {
- console.log(`BEFORE ALL [Enter]`);
- try {
- return cb();
- } catch (e) {
- throw e;
- } finally {
- console.log(`BEFORE ALL [Exit]`);
- }
- },
- );
- };
- var afterEach = (cb: AnyFunction) => {
- return afterEach_(
- cb instanceof async function () {}.constructor
- ? async () => {
- console.log(`AFTER EACH [Enter]`);
- try {
- return await cb();
- } catch (e) {
- throw e;
- } finally {
- console.log(`AFTER EACH [Exit]`);
- }
- }
- : () => {
- console.log(`AFTER EACH [Enter]`);
- try {
- return cb();
- } catch (e) {
- throw e;
- } finally {
- console.log(`AFTER EACH [Exit]`);
- }
- },
- );
- };
- var afterAll = (cb: AnyFunction) => {
- return afterAll_(
- cb instanceof async function () {}.constructor
- ? async () => {
- console.log(`AFTER ALL [Enter]`);
- try {
- return await cb();
- } catch (e) {
- throw e;
- } finally {
- console.log(`AFTER ALL [Exit]`);
- }
- }
- : () => {
- console.log(`AFTER ALL [Enter]`);
- try {
- return cb();
- } catch (e) {
- throw e;
- } finally {
- console.log(`AFTER ALL [Exit]`);
- }
- },
- );
- };
-
- return { describe, it, beforeEach, beforeAll, afterEach, afterAll };
-}