escss-estest
Advanced tools
Comparing version 1.4.21 to 1.4.22
/** | ||
* escss-estest v1.4.21 | ||
* escss-estest v1.4.22 | ||
* (c) 2024 Mike Lee | ||
@@ -86,3 +86,3 @@ * @license AGPL-3.0-only OR Commercial (https://github.com/ESCSS-labs) | ||
` | ||
🚫 Production hides details for security. View them in development. | ||
🚫 Production hides details for security. Viewable in development. | ||
❗ ${errMsg} | ||
@@ -93,3 +93,3 @@ `, | ||
/** | ||
* 100% function coverage for easier life. demo: https://demo-estest-log-not-visible.netlify.app/ | ||
* A runtime testing library inspired by TDD and TypeScript to achieve 100% coverage | ||
* @param {*} input | ||
@@ -99,30 +99,33 @@ * @param { 'undefined' | 'null' | 'array' | 'object' | 'boolean' | 'NaN' | 'number' | 'bigint' | 'string' | 'symbol' | 'function' } type | ||
*/ | ||
function ESTest(input, type, errMsg = 'undefined error message') { | ||
if (!TYPES.includes(type)) { | ||
if (process.env.NODE_ENV === 'production') getError(errMsg) | ||
else { | ||
throw new Error( | ||
` | ||
function ESTest(input, type, errMsg = 'undefined default error message') { | ||
try { | ||
if (process.env.NODE_ENV === 'test') _testToken = type | ||
if (!TYPES.includes(type)) { | ||
if (process.env.NODE_ENV === 'production') getError(errMsg) | ||
else { | ||
throw new Error( | ||
` | ||
✅ Expected 2nd Argument Type: 'undefined' | 'null' | 'array' | 'object' | 'boolean' | 'NaN' | 'number' | 'bigint' | 'string' | 'symbol' | 'function' | ||
❌ Received 2nd Argument: ${fixTextInLog(type)} | ||
`, | ||
) | ||
) | ||
} | ||
} | ||
} | ||
else if (!['undefined', 'string'].includes(typeof errMsg)) { | ||
if (process.env.NODE_ENV === 'production') getError(errMsg) | ||
else { | ||
throw new Error( | ||
` | ||
else if (!['undefined', 'string'].includes(typeof errMsg)) { | ||
if (process.env.NODE_ENV === 'production') getError(errMsg) | ||
else { | ||
throw new Error( | ||
` | ||
✅ Expected Error Message Type: 'string' | ||
❌ Received Error Message Type: '${fixType(errMsg)}' --> ${fixTextInLog(errMsg)} | ||
`, | ||
) | ||
) | ||
} | ||
} | ||
} | ||
else if (fixType(input) !== type) { | ||
if (process.env.NODE_ENV === 'production') getError(errMsg) | ||
else { | ||
throw new Error( | ||
` | ||
else if (fixType(input) !== type) { | ||
if (process.env.NODE_ENV === 'production') getError(errMsg) | ||
else { | ||
throw new Error( | ||
` | ||
✅ Expected Type: ${fixTextInLog(type)} | ||
@@ -132,10 +135,10 @@ ❌ Received Type: '${fixType(input)}' --> ${fixTextInLog(input)} | ||
`, | ||
) | ||
) | ||
} | ||
} | ||
} catch(error) { | ||
console.error(error) | ||
} | ||
// internal testing purpose | ||
if (process.env.NODE_ENV === 'test') _testToken = type | ||
} | ||
export { _testToken, ESTest } |
{ | ||
"name": "escss-estest", | ||
"version": "1.4.21", | ||
"version": "1.4.22", | ||
"description": "A runtime testing library inspired by TDD and TypeScript to achieve 100% coverage.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9235
145