Skip to content

Commit

Permalink
test(es/preset-env): Add a test for a wrong issue (#6794)
Browse files Browse the repository at this point in the history
**Related issue:**
 
 - Closes #6460.
  • Loading branch information
kdy1 committed Jan 12, 2023
1 parent ba91030 commit b29aa5b
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 11 deletions.
12 changes: 12 additions & 0 deletions crates/swc/tests/fixture/issues-6xxx/6460/1/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true
}
},
"env": {
"mode": "usage",
"coreJs": "3.26.1"
}
}
2 changes: 2 additions & 0 deletions crates/swc/tests/fixture/issues-6xxx/6460/1/input/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'1.2.3'.split('.').at(-1);
[123, 456].at(1);
7 changes: 7 additions & 0 deletions crates/swc/tests/fixture/issues-6xxx/6460/1/output/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import "core-js/modules/es.array.at.js";
import "core-js/modules/es.string.at-alternative.js";
"1.2.3".split(".").at(-1);
[
123,
456
].at(1);
2 changes: 1 addition & 1 deletion crates/swc_ecma_preset_env/data/core-js-compat/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -5117,7 +5117,7 @@
"chrome": "51",
"chrome-android": "51",
"deno": "1.0",
"edge": "15",
"edge": "79",
"electron": "1.2",
"firefox": "53",
"firefox-android": "53",
Expand Down
122 changes: 112 additions & 10 deletions crates/swc_ecma_preset_env/data/core-js-compat/entries.json
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,18 @@
"es.promise",
"es.string.iterator",
"esnext.async-iterator.constructor",
"esnext.async-iterator.drop",
"esnext.async-iterator.every",
"esnext.async-iterator.filter",
"esnext.async-iterator.find",
"esnext.async-iterator.flat-map",
"esnext.async-iterator.for-each",
"esnext.async-iterator.from",
"esnext.async-iterator.map",
"esnext.async-iterator.reduce",
"esnext.async-iterator.some",
"esnext.async-iterator.take",
"esnext.async-iterator.to-array",
"web.dom-collections.iterator"
],
"core-js/actual/async-iterator/map": [
Expand Down Expand Up @@ -1296,15 +1307,19 @@
],
"core-js/actual/disposable-stack": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"esnext.suppressed-error.constructor",
"esnext.disposable-stack.constructor"
"esnext.disposable-stack.constructor",
"esnext.iterator.dispose"
],
"core-js/actual/disposable-stack/constructor": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"esnext.suppressed-error.constructor",
"esnext.disposable-stack.constructor"
"esnext.disposable-stack.constructor",
"esnext.iterator.dispose"
],
"core-js/actual/dom-collections": [
"es.array.iterator",
Expand Down Expand Up @@ -1626,9 +1641,23 @@
"core-js/actual/iterator/from": [
"es.array.iterator",
"es.object.to-string",
"es.promise",
"es.string.iterator",
"esnext.iterator.constructor",
"esnext.iterator.dispose",
"esnext.iterator.drop",
"esnext.iterator.every",
"esnext.iterator.filter",
"esnext.iterator.find",
"esnext.iterator.flat-map",
"esnext.iterator.for-each",
"esnext.iterator.from",
"esnext.iterator.map",
"esnext.iterator.reduce",
"esnext.iterator.some",
"esnext.iterator.take",
"esnext.iterator.to-array",
"esnext.iterator.to-async",
"web.dom-collections.iterator"
],
"core-js/actual/iterator/map": [
Expand Down Expand Up @@ -2470,6 +2499,7 @@
],
"core-js/actual/suppressed-error": [
"es.error.cause",
"es.error.to-string",
"esnext.suppressed-error.constructor"
],
"core-js/actual/symbol": [
Expand Down Expand Up @@ -6113,17 +6143,23 @@
],
"core-js/features/async-disposable-stack": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"es.promise",
"esnext.suppressed-error.constructor",
"esnext.async-disposable-stack.constructor"
"esnext.async-disposable-stack.constructor",
"esnext.async-iterator.async-dispose",
"esnext.iterator.dispose"
],
"core-js/features/async-disposable-stack/constructor": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"es.promise",
"esnext.suppressed-error.constructor",
"esnext.async-disposable-stack.constructor"
"esnext.async-disposable-stack.constructor",
"esnext.async-iterator.async-dispose",
"esnext.iterator.dispose"
],
"core-js/features/async-iterator": [
"es.array.iterator",
Expand Down Expand Up @@ -6201,7 +6237,18 @@
"es.promise",
"es.string.iterator",
"esnext.async-iterator.constructor",
"esnext.async-iterator.drop",
"esnext.async-iterator.every",
"esnext.async-iterator.filter",
"esnext.async-iterator.find",
"esnext.async-iterator.flat-map",
"esnext.async-iterator.for-each",
"esnext.async-iterator.from",
"esnext.async-iterator.map",
"esnext.async-iterator.reduce",
"esnext.async-iterator.some",
"esnext.async-iterator.take",
"esnext.async-iterator.to-array",
"web.dom-collections.iterator"
],
"core-js/features/async-iterator/indexed": [
Expand Down Expand Up @@ -6317,15 +6364,19 @@
],
"core-js/features/disposable-stack": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"esnext.suppressed-error.constructor",
"esnext.disposable-stack.constructor"
"esnext.disposable-stack.constructor",
"esnext.iterator.dispose"
],
"core-js/features/disposable-stack/constructor": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"esnext.suppressed-error.constructor",
"esnext.disposable-stack.constructor"
"esnext.disposable-stack.constructor",
"esnext.iterator.dispose"
],
"core-js/features/dom-collections": [
"es.array.iterator",
Expand Down Expand Up @@ -6691,9 +6742,23 @@
"core-js/features/iterator/from": [
"es.array.iterator",
"es.object.to-string",
"es.promise",
"es.string.iterator",
"esnext.iterator.constructor",
"esnext.iterator.dispose",
"esnext.iterator.drop",
"esnext.iterator.every",
"esnext.iterator.filter",
"esnext.iterator.find",
"esnext.iterator.flat-map",
"esnext.iterator.for-each",
"esnext.iterator.from",
"esnext.iterator.map",
"esnext.iterator.reduce",
"esnext.iterator.some",
"esnext.iterator.take",
"esnext.iterator.to-array",
"esnext.iterator.to-async",
"web.dom-collections.iterator"
],
"core-js/features/iterator/indexed": [
Expand Down Expand Up @@ -7901,6 +7966,7 @@
],
"core-js/features/suppressed-error": [
"es.error.cause",
"es.error.to-string",
"esnext.suppressed-error.constructor"
],
"core-js/features/symbol": [
Expand Down Expand Up @@ -9650,17 +9716,23 @@
],
"core-js/full/async-disposable-stack": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"es.promise",
"esnext.suppressed-error.constructor",
"esnext.async-disposable-stack.constructor"
"esnext.async-disposable-stack.constructor",
"esnext.async-iterator.async-dispose",
"esnext.iterator.dispose"
],
"core-js/full/async-disposable-stack/constructor": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"es.promise",
"esnext.suppressed-error.constructor",
"esnext.async-disposable-stack.constructor"
"esnext.async-disposable-stack.constructor",
"esnext.async-iterator.async-dispose",
"esnext.iterator.dispose"
],
"core-js/full/async-iterator": [
"es.array.iterator",
Expand Down Expand Up @@ -9738,7 +9810,18 @@
"es.promise",
"es.string.iterator",
"esnext.async-iterator.constructor",
"esnext.async-iterator.drop",
"esnext.async-iterator.every",
"esnext.async-iterator.filter",
"esnext.async-iterator.find",
"esnext.async-iterator.flat-map",
"esnext.async-iterator.for-each",
"esnext.async-iterator.from",
"esnext.async-iterator.map",
"esnext.async-iterator.reduce",
"esnext.async-iterator.some",
"esnext.async-iterator.take",
"esnext.async-iterator.to-array",
"web.dom-collections.iterator"
],
"core-js/full/async-iterator/indexed": [
Expand Down Expand Up @@ -9854,15 +9937,19 @@
],
"core-js/full/disposable-stack": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"esnext.suppressed-error.constructor",
"esnext.disposable-stack.constructor"
"esnext.disposable-stack.constructor",
"esnext.iterator.dispose"
],
"core-js/full/disposable-stack/constructor": [
"es.error.cause",
"es.error.to-string",
"es.object.to-string",
"esnext.suppressed-error.constructor",
"esnext.disposable-stack.constructor"
"esnext.disposable-stack.constructor",
"esnext.iterator.dispose"
],
"core-js/full/dom-collections": [
"es.array.iterator",
Expand Down Expand Up @@ -10228,9 +10315,23 @@
"core-js/full/iterator/from": [
"es.array.iterator",
"es.object.to-string",
"es.promise",
"es.string.iterator",
"esnext.iterator.constructor",
"esnext.iterator.dispose",
"esnext.iterator.drop",
"esnext.iterator.every",
"esnext.iterator.filter",
"esnext.iterator.find",
"esnext.iterator.flat-map",
"esnext.iterator.for-each",
"esnext.iterator.from",
"esnext.iterator.map",
"esnext.iterator.reduce",
"esnext.iterator.some",
"esnext.iterator.take",
"esnext.iterator.to-array",
"esnext.iterator.to-async",
"web.dom-collections.iterator"
],
"core-js/full/iterator/indexed": [
Expand Down Expand Up @@ -11438,6 +11539,7 @@
],
"core-js/full/suppressed-error": [
"es.error.cause",
"es.error.to-string",
"esnext.suppressed-error.constructor"
],
"core-js/full/symbol": [
Expand Down

0 comments on commit b29aa5b

Please sign in to comment.