[Pkg-javascript-commits] [node-stack-utils] 27/67: Add a more complete list of Nodes internal files to `nodeInternals()`

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:53:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-stack-utils.

commit fe92db304dd8d0a58b30b81df5d8e911a543145b
Author: James Talmage <james at talmage.io>
Date:   Wed Jan 13 20:42:47 2016 -0500

    Add a more complete list of Nodes internal files to `nodeInternals()`
    
    Also swaps `[0-9]` for `\d` everywhere.
    
    Fixes #8.
---
 index.js                  | 21 +++++++++++----------
 test/long-stack-traces.js | 12 ++++--------
 test/test.js              |  2 +-
 3 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/index.js b/index.js
index 5551c72..2bb7f81 100644
--- a/index.js
+++ b/index.js
@@ -12,15 +12,16 @@ function StackUtils(opts) {
 module.exports.nodeInternals = nodeInternals;
 
 function nodeInternals() {
-	// This was tap specific
-	// /node_modules[\\\/]tap[\\\/](.*?)\.js:[0-9]:[0-9]\)?$/
 	return [
-		/\(domain.js:[0-9]+:[0-9]+\)$/,
-		/\(events.js:[0-9]+:[0-9]+\)$/,
-		/\(node.js:[0-9]+:[0-9]+\)$/,
-		/\(timers.js:[0-9]+:[0-9]+\)$/,
-		/\(module.js:[0-9]+:[0-9]+\)$/,
-		/GeneratorFunctionPrototype.next \(native\)/
+		/\(native\)$/,
+		/\(domain.js:\d+:\d+\)$/,
+		/\(events.js:\d+:\d+\)$/,
+		/\(node.js:\d+:\d+\)$/,
+		/\(timers.js:\d+:\d+\)$/,
+		/\(module.js:\d+:\d+\)$/,
+		/\(internal\/[\w_-]+\.js:\d+:\d+\)$/,
+		/\s*at node\.js:\d+:\d+?$/,
+		/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/
 	];
 }
 
@@ -211,11 +212,11 @@ var re = new RegExp(
 		// (eval at <anonymous> (file.js:1:1),
 		// $4 = eval origin
 		// $5:$6:$7 are eval file/line/col, but not normally reported
-	'(?:eval at ([^ ]+) \\(([^\\)]+):([0-9]+):([0-9]+)\\), )?' +
+	'(?:eval at ([^ ]+) \\(([^\\)]+):(\\d+):(\\d+)\\), )?' +
 		// file:line:col
 		// $8:$9:$10
 		// $11 = 'native' if native
-	'(?:([^\\)]+):([0-9]+):([0-9]+)|(native))' +
+	'(?:([^\\)]+):(\\d+):(\\d+)|(native))' +
 		// maybe close the paren, then end
 	'\\)?$'
 );
diff --git a/test/long-stack-traces.js b/test/long-stack-traces.js
index 3b432f8..293dded 100644
--- a/test/long-stack-traces.js
+++ b/test/long-stack-traces.js
@@ -8,14 +8,10 @@ import {join, fixtureDir} from './_utils';
 
 function internals() {
 	return StackUtils.nodeInternals().concat([
-		/\/long-stack-traces\.js:[0-9]+:[0-9]+\)?$/,
-		/\/internal-error\.js:[0-9]+:[0-9]+\)?$/,
-		/\/internal-then\.js:[0-9]+:[0-9]+\)?$/,
-		/\/node_modules\//,
-		// TODO: Should any of these be default internals?
-		/\/\.node-spawn-wrap-\w+-\w+\/node:[0-9]+:[0-9]+\)?$/,
-		/internal\/module\.js:[0-9]+:[0-9]+\)?$/,
-		/node\.js:[0-9]+:[0-9]+\)?$/
+		/\/long-stack-traces\.js:\d+:\d+\)?$/,
+		/\/internal-error\.js:\d+:\d+\)?$/,
+		/\/internal-then\.js:\d+:\d+\)?$/,
+		/\/node_modules\//
 	]);
 }
 
diff --git a/test/test.js b/test/test.js
index 2b54458..6ca7a4a 100644
--- a/test/test.js
+++ b/test/test.js
@@ -326,7 +326,7 @@ function internalStack() {
 
 function internals() {
 	return StackUtils.nodeInternals().concat([
-		/test\.js:[0-9]+:[0-9]+\)?$/,
+		/test\.js:\d+:\d+\)?$/,
 		/\/node_modules\//
 	]);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stack-utils.git



More information about the Pkg-javascript-commits mailing list