New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hpw

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hpw - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

Exercises/7-log.js

39

bin/hpw.js

@@ -66,10 +66,9 @@ #!/usr/bin/env node

const checkTarget = async (name, target, test) => {
if (typeof target === 'function') {
if (target.name !== test.name) {
throw new Error(`Function ${test.name} is not found`);
}
const msgTarget = concolor` Target: ${name}(b,white), `;
if (!target) {
console.log(msgTarget + 'Status: not found');
throw new Error(`No implementation detected: ${name}`);
}
const targetLength = target.toString().length;
const lines = countLines(target.toString());
const msgTarget = concolor` Target: ${name}(b,white), `;
const msgLength = concolor`Length: ${targetLength}(b,white), `;

@@ -112,4 +111,14 @@ const msgLines = concolor`Lines: ${lines}(b,white)`;

const target = js[name];
if (!target) throw new Error(`No implementation detected: ${name}`);
await checkTarget(name, target, currentTest);
try {
await checkTarget(name, target, currentTest);
} catch (e) {
exitCode = 1;
const lines = e.stack.split('\n');
if (lines[1].includes('at Object.test')) {
console.log(concolor` ${'Error: ' + e.message}(b,red)`);
} else {
const stack = lines.filter(s => !s.includes('hpw.js')).join('\n ');
console.log(concolor` ${stack}(b,red)`);
}
}
}

@@ -120,3 +129,3 @@ };

console.log(concolor.white('How Programming Works'));
console.log(concolor.info('Labs Auto Checker\n'));
console.log(concolor.info('Labs Auto Checker'));
const files = await fs.readdir(dir);

@@ -128,16 +137,6 @@ const tests = files

console.log(concolor`\nTest ${test}(b,white)`);
try {
await executeTest(test);
} catch (e) {
if (exitCode === 0) exitCode = 1;
const lines = e.stack.split('\n');
if (lines[1].includes('at Object.test')) {
console.log(concolor` ${'Error: ' + e.message}(b,red)`);
} else {
const stack = lines.filter(s => !s.includes('hpw.js')).join('\n ');
console.log(concolor` ${stack}(b,red)`);
}
}
await executeTest(test);
}
console.log('');
process.exit(exitCode);
})();
{
"name": "hpw",
"version": "0.1.10",
"version": "0.1.11",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -38,4 +38,4 @@ "description": "Labs Auto Checker",

"devDependencies": {
"eslint": "^6.7.2"
"eslint": "^6.8.0"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc