stacktracey 2.1.8 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: node_js
2
2
  node_js:
3
- - '8'
3
+ - '9'
4
4
  script:
5
5
  - set -e
6
6
  - npm run test
package/appveyor.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  environment:
2
2
  matrix:
3
- - nodejs_version: '8'
3
+ - nodejs_version: '12'
4
4
  install:
5
5
  - ps: Install-Product node $env:nodejs_version
6
6
  - set CI=true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stacktracey",
3
- "version": "2.1.8",
3
+ "version": "2.2.0",
4
4
  "description": "Parses call stacks. Reads sources. Clean & filtered output. Sourcemaps. Node & browsers.",
5
5
  "main": "stacktracey",
6
6
  "types": "./stacktracey.d.ts",
package/stacktracey.js CHANGED
@@ -130,6 +130,7 @@ class StackTracey {
130
130
 
131
131
  if ((planA = line.match (/at (.+) \(eval at .+ \((.+)\), .+\)/)) || // eval calls
132
132
  (planA = line.match (/at (.+) \((.+)\)/)) ||
133
+ (planA = line.match (/at (.+) ([^ ]+)/)) ||
133
134
  ((line.slice (0, 3) !== 'at ') && (planA = line.match (/(.*)@(.*)/)))) {
134
135
 
135
136
  callee = planA[1]
package/test.js CHANGED
@@ -232,10 +232,7 @@ describe ('StackTracey', () => {
232
232
  stack.items[0].syntaxError.should.equal (true)
233
233
  stack.items[0].column.should.equal (5)
234
234
 
235
- const spaces = nodeVersion > 8 ? ' ' : ' '
236
- const spaces2 = nodeVersion > 8 ? (nodeVersion > 11 ? ' ' : ' ') : ' '
237
-
238
- stack.asTable ().split ('\n')[0].should.equal ('at (syntax error)' + spaces + 'test_files/syntax_error.js:2' + spaces2 + 'foo->bar () ')
235
+ stack.asTable ().split ('\n')[0].should.match(/at \(syntax error\)\s+test_files\/syntax_error.js:2\s+foo->bar \(\)/)
239
236
  }
240
237
  })
241
238
  }
@@ -334,6 +331,28 @@ describe ('StackTracey', () => {
334
331
  items[1].fileRelative.should.equal('hohoho/test.js')
335
332
  })
336
333
 
334
+ it ('parses async frames', () => {
335
+ const stack = [
336
+ 'Error: test',
337
+ ' at async /some/index.js:1:1',
338
+ ' at async (/some/index.js:1:1)',
339
+ ' at async foo /some/index.js:1:1',
340
+ ' at async foo (/some/index.js:1:1)',
341
+ ].join ('\n')
342
+
343
+ const items = new StackTracey(stack).items
344
+
345
+ items[0].file.should.equal('/some/index.js')
346
+ items[1].file.should.equal('/some/index.js')
347
+ items[2].file.should.equal('/some/index.js')
348
+ items[3].file.should.equal('/some/index.js')
349
+
350
+ items[0].callee.should.equal('async')
351
+ items[1].callee.should.equal('async')
352
+ items[2].callee.should.equal('async foo')
353
+ items[3].callee.should.equal('async foo')
354
+ })
355
+
337
356
  it ('recognizes locations without column', () => {
338
357
  const stack = [
339
358
  'Error',
@@ -352,5 +371,3 @@ describe ('StackTracey', () => {
352
371
  })
353
372
  })
354
373
 
355
-
356
-