Skip to content

Latest commit

 

History

History
89 lines (63 loc) · 1.86 KB

README.md

File metadata and controls

89 lines (63 loc) · 1.86 KB

Mulika, Tiniest JavaScript Test Tool

Install mulika

npm i mulika 

Mulika CDN

Minimal in-browser UI add-on to your pages! Google Chrome, MS Edge recommended and Firefox.

Mulika Terminal

Add the scripts above any files to be tested in your html page.

<script src="https://pwafire.org/code/mulika/@latest.js"></script>

Add styles to your html page

<link rel="stylesheet" href="https://pwafire.org/code/mulika/@latest.css" />

Add the html component at the bottom of your html page in the body tag, before any scripts in your page.

<section id="mulika" class="mulika">
    <div class="top">
        <div class="btns">
            <span class="circle red"></span>
            <span class="circle yellow"></span>
            <span class="circle green"></span>
            <span class="mulika-title">Mulika Tests</span>
        </div>
    </div>
    <pre class="tests" id="tests"></pre>
</section>

Configuring for in-browser mulika

In your test js file, you need to enable debug/dev mode and start mulika first as shown below, all at the top of the test file.

// Mulika...
mulika.debug = true;
mulika.start();

//...

Specification...

All variables must be provided, all are required!

// Type check...
mulika.typeCheck({ type: type, value: value });

// Other tests...
mulika.expect(message, value, assertion);

Example...

Launch Playground Here

// Require mulika...
const mulika = require("mulika");

const registered = true;
// 1. Type check...
mulika.typeCheck({ type: "boolean", value: registered });

// 2. All tests...
mulika.expect("Sum to be 1", add(1, 9), 1);
// Function to test...
function add(a, b) {
    return a + b;
}

Enjoy!