Skip to content

Commit

Permalink
[Fix] do not use Object.prototype.toString when `Symbol.toStringTag…
Browse files Browse the repository at this point in the history
…` is shammed
  • Loading branch information
ljharb committed May 8, 2021
1 parent 4742c81 commit ca019fd
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 17 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/node-iojs.yml
Expand Up @@ -12,6 +12,7 @@ jobs:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
versionsAsRoot: true
preset: 'iojs'

latest:
Expand All @@ -21,7 +22,11 @@ jobs:

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}
matrix:
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
command:
- 'tests-only'
- 'test:corejs'

steps:
- uses: actions/checkout@v2
Expand All @@ -30,7 +35,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
skip-ls-check: true
- run: npm run tests-only
- run: npm run ${{ matrix.command }}
- uses: codecov/codecov-action@v1

minors:
Expand All @@ -42,7 +47,11 @@ jobs:

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}
matrix:
node-version: ${{ fromJson(needs.matrix.outputs.minors) }}
command:
- 'tests-only'
- 'test:corejs'

steps:
- uses: actions/checkout@v2
Expand All @@ -51,7 +60,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
skip-ls-check: true
- run: npm run tests-only
- run: npm run ${{ matrix.command }}
- uses: codecov/codecov-action@v1

node:
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/node-zero.yml
Expand Up @@ -12,6 +12,7 @@ jobs:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
versionsAsRoot: true
preset: '0.x'

stable:
Expand All @@ -21,7 +22,11 @@ jobs:

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.stable) }}
matrix:
node-version: ${{ fromJson(needs.matrix.outputs.stable) }}
command:
- 'tests-only'
- 'test:corejs'

steps:
- uses: actions/checkout@v2
Expand All @@ -31,7 +36,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
skip-ls-check: true
- run: npm run tests-only
- run: npm run ${{ matrix.command }}
- uses: codecov/codecov-action@v1

unstable:
Expand All @@ -43,7 +48,11 @@ jobs:

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.unstable) }}
matrix:
node-version: ${{ fromJson(needs.matrix.outputs.unstable) }}
command:
- 'tests-only'
- 'test:corejs'

steps:
- uses: actions/checkout@v2
Expand All @@ -53,7 +62,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
skip-ls-check: true
- run: npm run tests-only
- run: npm run ${{ matrix.command }}
- uses: codecov/codecov-action@v1

node:
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Expand Up @@ -25,3 +25,5 @@ coverage/
.nyc_output/

.github/workflows

test-corejs.js
1 change: 0 additions & 1 deletion .npmrc
@@ -1,4 +1,3 @@
package-lock=false
audit-level=moderate
allow-same-version=true
message=v%s
3 changes: 2 additions & 1 deletion .nycrc
Expand Up @@ -4,6 +4,7 @@
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
"test",
"test-corejs.js"
]
}
4 changes: 2 additions & 2 deletions index.js
@@ -1,8 +1,8 @@
'use strict';

var callBound = require('call-bind/callBound');
var hasSymbols = require('has-symbols')();
var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';
var hasSymbols = require('has-symbols/shams')();
var hasToStringTag = hasSymbols && !!Symbol.toStringTag;
var has;
var $exec;
var isRegexMarker;
Expand Down
7 changes: 4 additions & 3 deletions package.json
Expand Up @@ -15,6 +15,7 @@
"test": "npm run tests-only && npm run test:harmony",
"tests-only": "nyc node test",
"test:harmony": "nyc node --harmony --es-staging test",
"test:corejs": "nyc tape test-corejs.js",
"posttest": "npx aud --production",
"lint": "eslint .",
"eccheck": "eclint check *.js **/*.js > /dev/null",
Expand Down Expand Up @@ -45,6 +46,7 @@
"@ljharb/eslint-config": "^17.6.0",
"aud": "^1.1.5",
"auto-changelog": "^2.2.1",
"core-js": "^3.12.0",
"eclint": "^2.8.1",
"eslint": "^7.26.0",
"foreach": "^2.0.5",
Expand All @@ -53,7 +55,7 @@
"tape": "^5.2.2"
},
"testling": {
"files": "test.js",
"files": "test/index.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
Expand All @@ -62,8 +64,7 @@
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..12.0",
"opera/15.0..latest",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
Expand Down
5 changes: 5 additions & 0 deletions test-corejs.js
@@ -0,0 +1,5 @@
'use strict';

require('core-js');

require('./test');
4 changes: 2 additions & 2 deletions test/index.js
@@ -1,7 +1,7 @@
'use strict';

var hasSymbols = require('has-symbols')();
var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';
var hasSymbols = require('has-symbols/shams')();
var hasToStringTag = hasSymbols && !!Symbol.toStringTag;
var forEach = require('foreach');
var test = require('tape');
var isRegex = require('..');
Expand Down

0 comments on commit ca019fd

Please sign in to comment.