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(filter to throw error)
}
// happy path(the result that you are expected)
}
Vite >= 4.4.0 (if you use it)
import { ESTest } from 'escss-estest';
let isEnable = true
// impure function
function getSum(a, b) {
if(!isEnable) return 0
return a + b
}
// --------------------------------------------------
// pure function: test input by ESTest()
function getSum2(a, b) {
{
ESTest(a, 'number', 'mike 09102024 1')
ESTest(b, 'number', 'mike 09102024 2')
ESTest(isEnable, 'boolean', 'mike 09102024 3')
}
if(!isEnable) return 0
return a + b
}
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', 'mike 09102024 1')
ESTest(json.id, 'number', 'mike 09102024 2')
ESTest(json.title, 'string', 'mike 09102024 3')
ESTest(json.completed, 'boolean', 'mike 09102024 4')
}
console.log(json)
}
getData() // get error
import { ESTest } from 'escss-estest';
class Animal {
constructor(name, gender) {
{
ESTest(name, 'string', 'mike 09102024 1')
ESTest(gender, 'string', 'mike 09102024 2')
}
this.name = name
this.gender = gender
}
}
new Animal('cat', 123) // get error
// Type mode
ESTest(1, "number");
ESTest(1n, "bigint");
ESTest("foo", "string");
ESTest(true, "boolean");
ESTest([], "array"); // new type
ESTest({}, "object");
ESTest(NaN, "NaN"); // new type
ESTest(null, "null"); // new type
ESTest(undefined, "undefined"); // new type
ESTest(Symbol(), "symbol");
ESTest(function () {}, "function");
ESTest(1, "object"); // error
ESTest(1, "object", "mike 09062024 001"); // The error message should provide a unique ID for troubleshooting
// Operator mode
ESTest(1, "<", 5);
ESTest(5, ">", 1);
ESTest(1, "<=", 5);
ESTest(5, ">=", 1);
ESTest(1, "!==", 2);
ESTest(1, "===", 1);
ESTest(1, "===", 100); // error
ESTest(1, "===", 100, "mike 09062024 001"); // The error message should provide a unique ID for troubleshooting
Because initially started at v1.0.0 and experimented quite a bit and messed around, that's why.
Make sure you know what you are doing Before refactoring code base. When use ESCSS-ESTest make sure you have e2e、Backup branch and fellow's help, those tips will help a lot.
DISCLAIMER Author doesn't take any responsibility when you do refactoring.
npm 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.