Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
const tape = require("tape");
const tapes = require("tapes");
const addAssertions = require("extend-tape");
const sucrose = require("../fixtures/build/sucrose.js");
tape._missing = tape._missing || {};
tape._methods = tape._methods || {};
let _counter = 0;
let _left = 0;
// add a new assertions
const test = addAssertions(tape, {
methods(type, exclusions) {
let instance;
let native = Object.getOwnPropertyNames(new Function());
let common = ["dispatch"];
let excluded = native.concat(common, exclusions);
switch(type) {
case "area":
instance = sucrose.charts.areaChart();
break;
report(type) {
_counter -= 1;
if (tape._methods[type].length) {
tape._missing[type] = tape._methods[type];
_left += tape._methods[type].length;
}
if (_counter === 0) {
if (_left > 0) {
console.log("===================\nPublic methods left: " + _left);
console.log(tape._missing);
} else {
console.log("All public methods are covered!");
}
}
},
});