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

gunit

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gunit

Gets coverage or dies trying. CommonJS runtime for Gjs

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

gunit

Extracts require() from Acme Commander, to complement the CommonJS runtime in development and testing of GLib-heavy apps. Goal differs from Cgjs, not to replicate Node APIs, but to gather code coverage with Gjs built-in feature and, outside tests, give you the convenient module.hot.accept.

Parallel tests

Inspired by ava:

  • Runs tests concurrently

  • No implicit globals

  • Promise support

Having tests run concurrently forces you to write atomic tests, meaning tests don't depend on global state or the state of other tests, which is a great thing!

Test syntax

const { test } = require("gunit");

test("passes after awaiting promise", async t => {
  await Promise.resolve();

  t.pass();
});

test("compares values", t => {
  t.is(1 + 1, 2);
});

Usage

Make sure you have all dependencies, including GNOME JavaScript v1.52 or newer, and lcov:

# Ubuntu 17.10
sudo apt update && sudo apt install bash coreutils gir1.2-gtk-3.0 gjs lcov npm

Then install with npm:

npm install --save-dev gunit

Add a script to your package.json:

{
  "name": "awesome-package",
  "scripts": {
    "test": "gunit"
  },
  "devDependencies": {
    "gunit": "^1.0.1"
  }
}

Run it:

npm test

Will find and load *.test.js in your app directory.

CLI

$ gunit --help

Usage: gunit [OPTION]... [LAST_DIRNAME_WHITELIST]...
Find **/*.test.js and run with GNOME JavaScript.

  -s, --serial   disable concurrency
  -h, --help     display this help and exit

License

MIT

FAQs

Package last updated on 12 Nov 2018

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