Skip to content

Commit ca019fd

Browse files
committed
[Fix] do not use Object.prototype.toString when Symbol.toStringTag is shammed
1 parent 4742c81 commit ca019fd

File tree

9 files changed

+43
-17
lines changed

9 files changed

+43
-17
lines changed

.github/workflows/node-iojs.yml

+13-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
- uses: ljharb/actions/node/matrix@main
1313
id: set-matrix
1414
with:
15+
versionsAsRoot: true
1516
preset: 'iojs'
1617

1718
latest:
@@ -21,7 +22,11 @@ jobs:
2122

2223
strategy:
2324
fail-fast: false
24-
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}
25+
matrix:
26+
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
27+
command:
28+
- 'tests-only'
29+
- 'test:corejs'
2530

2631
steps:
2732
- uses: actions/checkout@v2
@@ -30,7 +35,7 @@ jobs:
3035
with:
3136
node-version: ${{ matrix.node-version }}
3237
skip-ls-check: true
33-
- run: npm run tests-only
38+
- run: npm run ${{ matrix.command }}
3439
- uses: codecov/codecov-action@v1
3540

3641
minors:
@@ -42,7 +47,11 @@ jobs:
4247

4348
strategy:
4449
fail-fast: false
45-
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}
50+
matrix:
51+
node-version: ${{ fromJson(needs.matrix.outputs.minors) }}
52+
command:
53+
- 'tests-only'
54+
- 'test:corejs'
4655

4756
steps:
4857
- uses: actions/checkout@v2
@@ -51,7 +60,7 @@ jobs:
5160
with:
5261
node-version: ${{ matrix.node-version }}
5362
skip-ls-check: true
54-
- run: npm run tests-only
63+
- run: npm run ${{ matrix.command }}
5564
- uses: codecov/codecov-action@v1
5665

5766
node:

.github/workflows/node-zero.yml

+13-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
- uses: ljharb/actions/node/matrix@main
1313
id: set-matrix
1414
with:
15+
versionsAsRoot: true
1516
preset: '0.x'
1617

1718
stable:
@@ -21,7 +22,11 @@ jobs:
2122

2223
strategy:
2324
fail-fast: false
24-
matrix: ${{ fromJson(needs.matrix.outputs.stable) }}
25+
matrix:
26+
node-version: ${{ fromJson(needs.matrix.outputs.stable) }}
27+
command:
28+
- 'tests-only'
29+
- 'test:corejs'
2530

2631
steps:
2732
- uses: actions/checkout@v2
@@ -31,7 +36,7 @@ jobs:
3136
node-version: ${{ matrix.node-version }}
3237
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
3338
skip-ls-check: true
34-
- run: npm run tests-only
39+
- run: npm run ${{ matrix.command }}
3540
- uses: codecov/codecov-action@v1
3641

3742
unstable:
@@ -43,7 +48,11 @@ jobs:
4348

4449
strategy:
4550
fail-fast: false
46-
matrix: ${{ fromJson(needs.matrix.outputs.unstable) }}
51+
matrix:
52+
node-version: ${{ fromJson(needs.matrix.outputs.unstable) }}
53+
command:
54+
- 'tests-only'
55+
- 'test:corejs'
4756

4857
steps:
4958
- uses: actions/checkout@v2
@@ -53,7 +62,7 @@ jobs:
5362
node-version: ${{ matrix.node-version }}
5463
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
5564
skip-ls-check: true
56-
- run: npm run tests-only
65+
- run: npm run ${{ matrix.command }}
5766
- uses: codecov/codecov-action@v1
5867

5968
node:

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ coverage/
2525
.nyc_output/
2626

2727
.github/workflows
28+
29+
test-corejs.js

.npmrc

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
package-lock=false
2-
audit-level=moderate
32
allow-same-version=true
43
message=v%s

.nycrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"reporter": ["text-summary", "text", "html", "json"],
55
"exclude": [
66
"coverage",
7-
"test"
7+
"test",
8+
"test-corejs.js"
89
]
910
}

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

33
var callBound = require('call-bind/callBound');
4-
var hasSymbols = require('has-symbols')();
5-
var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';
4+
var hasSymbols = require('has-symbols/shams')();
5+
var hasToStringTag = hasSymbols && !!Symbol.toStringTag;
66
var has;
77
var $exec;
88
var isRegexMarker;

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"test": "npm run tests-only && npm run test:harmony",
1616
"tests-only": "nyc node test",
1717
"test:harmony": "nyc node --harmony --es-staging test",
18+
"test:corejs": "nyc tape test-corejs.js",
1819
"posttest": "npx aud --production",
1920
"lint": "eslint .",
2021
"eccheck": "eclint check *.js **/*.js > /dev/null",
@@ -45,6 +46,7 @@
4546
"@ljharb/eslint-config": "^17.6.0",
4647
"aud": "^1.1.5",
4748
"auto-changelog": "^2.2.1",
49+
"core-js": "^3.12.0",
4850
"eclint": "^2.8.1",
4951
"eslint": "^7.26.0",
5052
"foreach": "^2.0.5",
@@ -53,7 +55,7 @@
5355
"tape": "^5.2.2"
5456
},
5557
"testling": {
56-
"files": "test.js",
58+
"files": "test/index.js",
5759
"browsers": [
5860
"iexplore/6.0..latest",
5961
"firefox/3.0..6.0",
@@ -62,8 +64,7 @@
6264
"chrome/4.0..10.0",
6365
"chrome/20.0..latest",
6466
"chrome/canary",
65-
"opera/10.0..12.0",
66-
"opera/15.0..latest",
67+
"opera/10.0..latest",
6768
"opera/next",
6869
"safari/4.0..latest",
6970
"ipad/6.0..latest",

test-corejs.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
require('core-js');
4+
5+
require('./test');

test/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
var hasSymbols = require('has-symbols')();
4-
var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';
3+
var hasSymbols = require('has-symbols/shams')();
4+
var hasToStringTag = hasSymbols && !!Symbol.toStringTag;
55
var forEach = require('foreach');
66
var test = require('tape');
77
var isRegex = require('..');

0 commit comments

Comments
 (0)