Skip to content

Commit 6afaba0

Browse files
committed
Adding test matrix entry using core-js/modules/es.error.cause
1 parent b6cced7 commit 6afaba0

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- io.js 3.x
1919
- Node.js 4.x
2020
- Node.js 5.x
21+
- Node.js 5.x with core-js polyfill
2122
- Node.js 6.x
2223
- Node.js 7.x
2324
- Node.js 8.x
@@ -63,6 +64,12 @@ jobs:
6364
node-version: "5.12"
6465
6566

67+
- name: Node.js 5.x with core-js polyfill
68+
node-version: "5.12"
69+
70+
env:
71+
ENABLE_COREJS_ERROR_POLYFILL: true
72+
6673
- name: Node.js 6.x
6774
node-version: "6.17"
6875
@@ -158,6 +165,7 @@ jobs:
158165
159166
- name: Run tests
160167
shell: bash
168+
env: ${{ matrix.env }}
161169
run: |
162170
if npm -ps ls nyc | grep -q nyc; then
163171
npm run test-ci

index.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -265,25 +265,22 @@ function log (message, site) {
265265
*/
266266

267267
function callSiteLocation (callSite) {
268-
var functionName, site
269268
if (callSite) {
270-
functionName = callSite.getFunctionName()
271269
var file = callSite.getFileName() || '<anonymous>'
272270
var line = callSite.getLineNumber()
273271
var colm = callSite.getColumnNumber()
274272
if (callSite.isEval()) {
275273
file = callSite.getEvalOrigin() + ', ' + file
276274
}
277-
site = [file, line, colm]
275+
var site = [file, line, colm]
276+
site.callSite = callSite
277+
site.name = callSite.getFunctionName()
278278
} else {
279-
// eslint-disable-next-line no-param-reassign
280-
callSite = {}
281-
callSite.getThis = function () { return null }
282-
functionName = '<unknown function>'
283-
site = ['<unknown file>', '<unknown line>', '<unknown column>']
279+
var site = ['<unknown file>', '<unknown line>', '<unknown column>']
280+
site.callSite = {}
281+
site.callSite.getThis = function () { return null }
282+
site.name = '<unknown function>'
284283
}
285-
site.callSite = callSite
286-
site.name = functionName
287284
return site
288285
}
289286

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
"repository": "dougwilson/nodejs-depd",
1212
"browser": "lib/browser/index.js",
1313
"devDependencies": {
14-
"benchmark": "2.1.4",
1514
"beautify-benchmark": "0.2.4",
15+
"benchmark": "2.1.4",
16+
"core-js": "^3.21.1",
1617
"eslint": "7.21.0",
1718
"eslint-config-standard": "14.1.1",
1819
"eslint-plugin-import": "2.22.1",
1920
"eslint-plugin-markdown": "1.0.2",
2021
"eslint-plugin-node": "9.2.0",
2122
"eslint-plugin-promise": "4.2.1",
2223
"eslint-plugin-standard": "4.1.0",
23-
"nyc": "15.1.0",
2424
"mocha": "8.2.1",
25+
"nyc": "15.1.0",
2526
"safe-buffer": "5.1.2"
2627
},
2728
"files": [

test/test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ var script = path.join(__dirname, 'fixtures', 'script.js')
1010
var spawn = require('child_process').spawn
1111
var strictlib = libs.strict
1212

13+
if (process.env.ENABLE_COREJS_ERROR_POLYFILL) { // cf. PR #48
14+
require('core-js/modules/es.error.cause')
15+
}
16+
1317
describe('depd(namespace)', function () {
1418
it('creates deprecated function', function () {
1519
assert.strictEqual(typeof depd('test'), 'function')

0 commit comments

Comments
 (0)