Skip to content

Tap Scripts

You can create a script file.

Not documented yet.

Parsing script file

import { GrammarHelper, ProgInstructions, ScriptRunner } from '@iotize/testing-grammar.js';
let fileContent = readFileSync(options.file).toString();   
var instructions: ProgInstructions[] = GrammarHelper.toProgInstructions(fileContent);
// Not yet documented

Executing instructions

let testRunner = new ScriptRunner(device);

testRunner
    .run(instructions)
    .subscribe({
        next: (event: any) => {
            console.log(event);
        },
        complete: async () => {
            await device.disconnect();
            global.output.success(`Script execution DONE!`);
        },
        error: async (err) => {
            global.output.error(`${err.toString()}`)
        }
    });
// Not yet documented