diff options
author | 2023-03-14 16:42:16 -0700 | |
---|---|---|
committer | 2023-03-14 16:42:26 -0700 | |
commit | eb9e3e9aecc8696e5117eb82eaa4d543f957a134 (patch) | |
tree | 69804c75db7b4aae470035ebf11f8c7059f1f56d | |
parent | 851fd039dae1791b64cd868ed8e057b6b6bcdd51 (diff) | |
download | bun-eb9e3e9aecc8696e5117eb82eaa4d543f957a134.tar.gz bun-eb9e3e9aecc8696e5117eb82eaa4d543f957a134.tar.zst bun-eb9e3e9aecc8696e5117eb82eaa4d543f957a134.zip |
Update harness.ts
-rw-r--r-- | test/js/deno/harness.ts | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/test/js/deno/harness.ts b/test/js/deno/harness.ts index 70f0ceede..01924758d 100644 --- a/test/js/deno/harness.ts +++ b/test/js/deno/harness.ts @@ -4,13 +4,39 @@ export * from "./harness/assert.js"; export * from "./harness/fixture.js"; import { readTextFile } from "./harness/fixture.js"; +import { callerSourceOrigin } from "bun:jsc"; import { test } from "./harness/test.js"; +import { hideFromStackTrace } from "harness"; + +const internalSymbol = Symbol("Deno[internal]"); +class BrokenTest extends Error { + constructor(message) { + super(message); + this.name = "BrokenTest"; + } +} + +hideFromStackTrace(BrokenTest.prototype.constructor); + +const handler = { + get(target: any, prop: string) { + throw new BrokenTest( + "Deno[Deno.internal]." + + String(prop) + + " accessed in " + + callerSourceOrigin() + + ".\n\nThis test should not be included in the test harness. Please skip or remove it from the test runner.", + ); + }, +}; + +hideFromStackTrace(handler.get); export const Deno = { test, readTextFile, - internal: "[internal]", - ["[internal]"]: {}, + internal: internalSymbol, + [internalSymbol]: new Proxy({}, handler), }; // @ts-expect-error |