Socket
Socket
Sign inDemoInstall

commonjs-walker

Package Overview
Dependencies
15
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.2 to 7.0.3

test/fixtures/parser/parse-error.js

13

lib/parser.js

@@ -22,3 +22,4 @@ 'use strict'

code: 'ERROR_PARSE_JS',
message: 'Error parsing "' + path + '": ' + err.stack,
message: 'Error parsing "' + path + '": '
+ parser._fixes_line_code(err.stack),
data: {

@@ -42,3 +43,4 @@ path: path,

code: 'WRONG_USAGE_REQUIRE',
message: 'Error parsing dependencies: ' + e.message,
message: 'Error parsing dependencies: '
+ parser._fixes_line_code(e.message),
data: {

@@ -91,2 +93,9 @@ path: path,

parser._fixes_line_code = function(message) {
return message.replace(/Line\s*(\d+)/i, function (m, g1) {
return 'Line ' + (parseInt(g1) - 1)
})
}
// Parses AST and returns the dependencies

@@ -93,0 +102,0 @@ parser._parse_dependencies = function (node, dependencies, options) {

2

package.json
{
"name": "commonjs-walker",
"version": "7.0.2",
"version": "7.0.3",
"description": "Analyzer and tree walker for commonjs.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -59,2 +59,11 @@ 'use strict';

deps: ['..']
},
{
desc: '#28: uses original line code',
file: 'parse-error.js',
options: {},
error: true,
expect: function (err) {
expect(/Line 1/.test(err.message)).to.equal(true)
}
}

@@ -73,6 +82,12 @@ ];

done();
expect(!err).to.equal(!c.error);
if (c.expect) {
c.expect(err, result)
} else {
expect(!err).to.equal(!c.error);
}
if (util.isArray(c.deps)) {
expect(result.require.sort()).to.deep.equal(c.deps.sort());
}
});

@@ -79,0 +94,0 @@ });

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc