File tree Expand file tree Collapse file tree 4 files changed +20
-11
lines changed Expand file tree Collapse file tree 4 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ impl FromStr for ESTarget {
2727 fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
2828 match s. cow_to_lowercase ( ) . as_ref ( ) {
2929 "es5" => Ok ( Self :: ES5 ) ,
30- "es2015" => Ok ( Self :: ES2015 ) ,
30+ "es6" | " es2015" => Ok ( Self :: ES2015 ) ,
3131 "es2016" => Ok ( Self :: ES2016 ) ,
3232 "es2017" => Ok ( Self :: ES2017 ) ,
3333 "es2018" => Ok ( Self :: ES2018 ) ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ fn es_target() {
1010
1111 let cases = [
1212 ( "es5" , "() => {}" ) ,
13+ ( "es6" , "a ** b" ) ,
1314 ( "es2015" , "a ** b" ) ,
1415 ( "es2016" , "async function foo() {}" ) ,
1516 ( "es2017" , "({ ...x })" ) ,
Original file line number Diff line number Diff line change 11-- -
22source : crates / oxc_transformer / tests / integrations / es_target .rs
3+ assertion_line : 50
34snapshot_kind : text
45-- -
56########## 0 es5
67() => {}
78----------
89(function () {});
910
10- ########## 1 es2015
11+ ########## 1 es6
1112a ** b
1213----------
1314Math .pow (a , b );
1415
15- ########## 2 es2016
16+ ########## 2 es2015
17+ a ** b
18+ ----------
19+ Math .pow (a , b );
20+
21+ ########## 3 es2016
1622async function foo() {}
1723----------
1824import _asyncToGenerator from ' @babel/runtime/helpers/asyncToGenerator' ;
@@ -24,35 +30,35 @@ function _foo() {
2430 return _foo .apply (this , arguments );
2531}
2632
27- ########## 3 es2017
33+ ########## 4 es2017
2834({ ... x })
2935----------
3036import _objectSpread from ' @babel/runtime/helpers/objectSpread2' ;
3137_objectSpread ({}, x );
3238
33- ########## 4 es2018
39+ ########## 5 es2018
3440try {} catch {}
3541----------
3642try {} catch (_unused ) {}
3743
38- ########## 5 es2019
44+ ########## 6 es2019
3945a ? .b
4046----------
4147var _a ;
4248(_a = a ) === null || _a === void 0 ? void 0 : _a .b ;
4349
44- ########## 6 es2019
50+ ########## 7 es2019
4551a ?? b
4652----------
4753var _a ;
4854(_a = a ) !== null && _a !== void 0 ? _a : b ;
4955
50- ########## 7 es2020
56+ ########## 8 es2020
5157a || = b
5258----------
5359a || (a = b );
5460
55- ########## 8 es2019
61+ ########## 9 es2019
56621n ** 2n
5763----------
5864
@@ -71,14 +77,14 @@ a || (a = b);
7177 : ^^
7278 ` ----
7379
74- ########## 9 es2021
80+ ########## 10 es2021
7581class foo { static {} }
7682----------
7783class foo {
7884 static #_ = (() => {})();
7985}
8086
81- ########## 10 es2021
87+ ########## 11 es2021
8288class Foo { #a ; }
8389----------
8490class Foo {
Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ describe('transform', () => {
5757
5858describe ( 'target' , ( ) => {
5959 const data = [
60+ [ 'es5' , '() => {};\n' ] ,
61+ [ 'es6' , 'a ** b;\n' ] ,
6062 [ 'es2015' , 'a ** b;\n' ] ,
6163 [ 'es2016' , 'async function foo() {}\n' ] ,
6264 [ 'es2017' , '({ ...x });\n' ] ,
You can’t perform that action at this time.
0 commit comments