Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@denofill/testing

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@denofill/testing

🧪 Deno.test() and Deno.bench() for anywhere

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Deno testing for anywhere

🧪 [Deno.test()] and [Deno.bench()] for anywhere

Installation

You can install this package using npm, pnpm, Yarn, or your other favorite npm package manager:

npm install @denofill/testing

Usage

You can import this package in Node.js, Deno, and the browser and it will Just Work™. In Deno, you'll get a passthrough to the native Deno.test() function, while in Node.js and the browser you'll get a shim that implements the same API.

// If you set DENOFILL_TEST=1 in Node.js, this will run the tests. Otherwise,
// this will be a no-op.
import * as Deno from "@denofill/testing";
import assert from "node:assert";

Deno.test("1 + 2 = 3", () => {
  assert.equal(1 + 2, 3);
});
<script>
  // You can also manually do this in DevTools and reload the page.
  sessionStorage.setItem("denofill_test", "1");
</script>
<script type="module">
  import * as Deno from "https://esm.run/@denofill/testing";
  import assert from "https://esm.run/@nodefill/assert";

  Deno.test("1 + 2 = 3", () => {
    assert.equal(1 + 2, 3);
  });
</script>

⚠️ Even though it kinda looks like it, the Deno import is not the real Deno namespace object! It's only got two functions: Deno.test() and Deno.bench().

You can also use the shim CLI to run tests and benchmarks using tsx:

denofilltest
denofillbench
You can combine this Deno namespace with other @denofill modules to build a custom Deno namespace
import * as Deno1 from "@denofill/testing";
import * as Deno2 from "@denofill/http-server";
const Deno = { ...Deno1, ...Deno2 };

Keywords

FAQs

Package last updated on 19 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc