Inaft demo

Inaft is a test harness. It is ordinarily distributed as a self-contained, single-file "app" that you can drop into your project's source tree. We seek to demonstrate its use here without requiring any fiddling around to download a copy and set up a project with the correct directory structure. Instead, we simulate what would happen if you had already cloned the repo for a project that uses Inaft for its tests, began poking around, and ended up with Inaft open.

Suppose your copy of Inaft lived at tests/harness.app.htm, along with the following other files:

tests/equality-of-signed-zeroes/index.js
import { test } from "$TEST_HELPER"

test(() => {
  test.ok(+0 === -0)
})
        
tests/multiple-checks/index.js
import { test } from "$TEST_HELPER"

test(() => {
  test.is( 0, 0)
  test.is(+0, 0)
  test.is(-0, 0)
})

test(() => {
  test.ok(2 < 4294967296)
})

test(() => {
  test.is(6 * 9, 42)
})
        
tests/importing-modules/index.js
import { test } from "$TEST_HELPER"

import { Foo } from "$PROJECT/src/foo.js"

test(() => {
  let value = (new Foo).bar;
  test.is(value, "baz");
})
        
src/foo.js
export class Foo {
  constructor() {
    this.bar = "baz";
  }
}
        

The Inaft instance running in the porthole below has been wired up for this demo so that clicking "Open…" will cause Inaft to work as if it has been pointed at a project with this file tree, rather than prompting you to provide a project from your local disk.

Colby Russell

July 2021

//? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //? //?