Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
escss-estest
Advanced tools
ESCSS-ESTest helps you to achieve 100% coverage by taking the potential of TDD and TypeScript.
function foo() {
{
// unhappy path(throw error)
}
// happy path
}
// Type mode
ESTest(NaN, "NaN"); // new
ESTest([], "array"); // new
ESTest(null, "null"); // new
ESTest(undefined, "undefined"); // new
ESTest(1, "number");
ESTest("foo", "string");
ESTest(true, "boolean");
ESTest({}, "object");
ESTest(1n, "bigint");
ESTest(Symbol(), "symbol");
ESTest(function () {}, "function");
ESTest(1, "object"); // error
ESTest(1, "object", "foo"); // error message
import { ESTest } from "escss-estest";
let isEnable = true;
// Pure (input in {...})
function getSum2(a, b) {
{
ESTest(a, "number");
ESTest(b, "number");
ESTest(isEnable, "boolean");
}
if (!isEnable) return 0;
return a + b;
}
// Impure
function getSum(a, b) {
if (!isEnable) return 0;
return a + b;
}
// NOTE: the "function" type check is unnecessary.
function getTotalNumber(x) {
{
ESTest(x, "number");
// If the function doesn't exist, it will return 'xxx is undefined.'
// If the function exists, getSum2(a, b) will handle type check, so the "function" check is redundant.
ESTest(getSum2, "function"); // not necessary.
}
return x + getSum2(1, 2);
}
import { ESTest, getData } from "escss-estest";
async function getData() {
const url = "https://jsonplaceholder.typicode.com/todos/99999"; // undefined api
const response = await fetch(url);
const json = await response.json();
{
ESTest(json.userId, "number");
ESTest(json.id, "number");
ESTest(json.title, "string");
ESTest(json.completed, "boolean");
}
console.log(json);
}
getData(); // get error (undefined api from 99999)
import { ESTest } from "escss-estest";
class Animal {
constructor(name, age) {
{
ESTest(name, "string");
ESTest(age, "number");
}
this.name = name;
this.age = age;
}
}
new Animal("cat", "10"); // get error, "10" should be number
# Using npm
npm add escss-estest
# Using yarn
yarn add escss-estest
# Using pnpm
pnpm add escss-estest
# Using bun
bun add escss-estest
FAQs
A runtime testing library inspired by TDD and TypeScript to achieve 100% coverage.
The npm package escss-estest receives a total of 504 weekly downloads. As such, escss-estest popularity was classified as not popular.
We found that escss-estest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.