summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-02-23 17:18:43 +0100
committerRyan Dahl <ry@tinyclouds.org>2019-02-23 11:18:43 -0500
commitad7721505205be39fdefe22a154a71033002016d (patch)
treef159285dbf82fdf4259e84a8452b06286eb3b186
parenta4383984d1a5aa3d6b3d843a89ded8fbb1015d36 (diff)
Add runIfMain method (denoland/deno_std#215)
Original: https://github.com/denoland/deno_std/commit/817a0fb439ff92cd67da8d4f1dae12a2a08121e1
-rw-r--r--testing/mod.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/testing/mod.ts b/testing/mod.ts
index e8e00ca74..45a38919a 100644
--- a/testing/mod.ts
+++ b/testing/mod.ts
@@ -290,3 +290,9 @@ export async function runTests() {
}, 0);
}
}
+
+export async function runIfMain(meta: ImportMeta) {
+ if (window.location.toString() === meta.url) {
+ runTests();
+ }
+}