-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(bindings/ts): Test Wasm binding (#9128)
**Description:** Now, the build pipeline is running, so I'll look into testing the Wasm binary.
- Loading branch information
Showing
6 changed files
with
48 additions
and
9 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const swc = require("../pkg"); | ||
|
||
it("properly reports error", function () { | ||
expect(() => { | ||
swc.transformSync("Foo {}", {}); | ||
}).toThrow(); | ||
}); | ||
|
||
describe("trannsform", () => { | ||
it("should strip types", async () => { | ||
const { code } = await swc.transform( | ||
` | ||
export const foo: number = 1; | ||
type Foo = number; | ||
`, | ||
{} | ||
); | ||
expect(code).toMatchInlineSnapshot(` | ||
"export const foo = 1; | ||
" | ||
`); | ||
}); | ||
|
||
it("should preserve enum", async () => { | ||
const { code } = await swc.transform( | ||
` | ||
enum Foo { | ||
Bar | ||
} | ||
`, | ||
{} | ||
); | ||
await expect(code).toMatchInlineSnapshot(` | ||
"enum Foo { | ||
Bar | ||
} | ||
" | ||
`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
wasm-pack build --debug --scope swc -t nodejs --features getrandom/js $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
./scripts/build.sh | ||
npx jest $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c6d6db3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
es/full/bugs-1
291711
ns/iter (± 7351
)271823
ns/iter (± 3130
)1.07
es/full/minify/libraries/antd
1805953667
ns/iter (± 84758697
)1863842592
ns/iter (± 53582346
)0.97
es/full/minify/libraries/d3
349549990
ns/iter (± 9993807
)352590093
ns/iter (± 7910659
)0.99
es/full/minify/libraries/echarts
1523995820
ns/iter (± 42340439
)1582995152
ns/iter (± 38987641
)0.96
es/full/minify/libraries/jquery
104324436
ns/iter (± 1131651
)104773834
ns/iter (± 987597
)1.00
es/full/minify/libraries/lodash
115222432
ns/iter (± 689340
)114513042
ns/iter (± 1865510
)1.01
es/full/minify/libraries/moment
61684699
ns/iter (± 467136
)59679843
ns/iter (± 282125
)1.03
es/full/minify/libraries/react
19055633
ns/iter (± 77705
)18297506
ns/iter (± 87423
)1.04
es/full/minify/libraries/terser
329985348
ns/iter (± 4836528
)284575376
ns/iter (± 6247233
)1.16
es/full/minify/libraries/three
607664243
ns/iter (± 21021281
)485299015
ns/iter (± 7869889
)1.25
es/full/minify/libraries/typescript
3320036783
ns/iter (± 50453410
)3345884124
ns/iter (± 43121690
)0.99
es/full/minify/libraries/victory
743172517
ns/iter (± 12018993
)796110990
ns/iter (± 34243512
)0.93
es/full/minify/libraries/vue
149671475
ns/iter (± 771372
)150026429
ns/iter (± 2035132
)1.00
es/full/codegen/es3
61642
ns/iter (± 391
)58972
ns/iter (± 205
)1.05
es/full/codegen/es5
61825
ns/iter (± 312
)59118
ns/iter (± 247
)1.05
es/full/codegen/es2015
61506
ns/iter (± 250
)58838
ns/iter (± 104
)1.05
es/full/codegen/es2016
61430
ns/iter (± 316
)58992
ns/iter (± 135
)1.04
es/full/codegen/es2017
61809
ns/iter (± 313
)58651
ns/iter (± 213
)1.05
es/full/codegen/es2018
61480
ns/iter (± 205
)58908
ns/iter (± 174
)1.04
es/full/codegen/es2019
61815
ns/iter (± 289
)58869
ns/iter (± 172
)1.05
es/full/codegen/es2020
61505
ns/iter (± 171
)59093
ns/iter (± 197
)1.04
es/full/all/es3
160731563
ns/iter (± 779089
)164581425
ns/iter (± 1635223
)0.98
es/full/all/es5
154938165
ns/iter (± 1436925
)157774218
ns/iter (± 459558
)0.98
es/full/all/es2015
114445101
ns/iter (± 1508768
)116786440
ns/iter (± 635207
)0.98
es/full/all/es2016
113026235
ns/iter (± 625883
)116088298
ns/iter (± 732581
)0.97
es/full/all/es2017
112989868
ns/iter (± 1894266
)115458818
ns/iter (± 500864
)0.98
es/full/all/es2018
110989883
ns/iter (± 751677
)113615567
ns/iter (± 1445391
)0.98
es/full/all/es2019
110594997
ns/iter (± 361095
)113108279
ns/iter (± 481733
)0.98
es/full/all/es2020
106589737
ns/iter (± 1217622
)108897053
ns/iter (± 541266
)0.98
es/full/parser
451087
ns/iter (± 2050
)476073
ns/iter (± 3527
)0.95
es/full/base/fixer
15313
ns/iter (± 125
)16326
ns/iter (± 142
)0.94
es/full/base/resolver_and_hygiene
80866
ns/iter (± 407
)80185
ns/iter (± 272
)1.01
serialization of serde
263
ns/iter (± 6
)272
ns/iter (± 1
)0.97
css/minify/libraries/bootstrap
23045467
ns/iter (± 58685
)21988681
ns/iter (± 106960
)1.05
css/visitor/compare/clone
1391863
ns/iter (± 28144
)1378273
ns/iter (± 4730
)1.01
css/visitor/compare/visit_mut_span
1518309
ns/iter (± 9026
)1509342
ns/iter (± 8078
)1.01
css/visitor/compare/visit_mut_span_panic
1550361
ns/iter (± 29054
)1493289
ns/iter (± 40735
)1.04
css/visitor/compare/fold_span
2032196
ns/iter (± 54543
)2002076
ns/iter (± 7929
)1.02
css/visitor/compare/fold_span_panic
2254965
ns/iter (± 38917
)2127608
ns/iter (± 10023
)1.06
css/lexer/bootstrap_5_1_3
3447449
ns/iter (± 3561
)3473056
ns/iter (± 2527
)0.99
css/lexer/foundation_6_7_4
2784479
ns/iter (± 1786
)2800058
ns/iter (± 1531
)0.99
css/lexer/tailwind_3_1_1
536800
ns/iter (± 1005
)540376
ns/iter (± 967
)0.99
css/parser/bootstrap_5_1_3
16675684
ns/iter (± 193077
)15936355
ns/iter (± 32436
)1.05
css/parser/foundation_6_7_4
13301828
ns/iter (± 120672
)12771280
ns/iter (± 45300
)1.04
css/parser/tailwind_3_1_1
2540260
ns/iter (± 20199
)2524658
ns/iter (± 5329
)1.01
es/codegen/colors
724498
ns/iter (± 395220
)723865
ns/iter (± 398987
)1.00
es/codegen/large
2954037
ns/iter (± 1576070
)2998386
ns/iter (± 1604948
)0.99
es/codegen/with-parser/colors
40263
ns/iter (± 589
)40497
ns/iter (± 569
)0.99
es/codegen/with-parser/large
447756
ns/iter (± 11520
)457452
ns/iter (± 2546
)0.98
es/minify/libraries/antd
1422161603
ns/iter (± 23048737
)1601709836
ns/iter (± 26132240
)0.89
es/minify/libraries/d3
281246306
ns/iter (± 1075581
)331733566
ns/iter (± 20435978
)0.85
es/minify/libraries/echarts
1141508402
ns/iter (± 11748302
)1318155078
ns/iter (± 24239452
)0.87
es/minify/libraries/jquery
82456586
ns/iter (± 277607
)86351469
ns/iter (± 1132482
)0.95
es/minify/libraries/lodash
104347537
ns/iter (± 242306
)105698229
ns/iter (± 1601013
)0.99
es/minify/libraries/moment
48317666
ns/iter (± 167750
)49110479
ns/iter (± 733539
)0.98
es/minify/libraries/react
16223778
ns/iter (± 12313
)16433213
ns/iter (± 124186
)0.99
es/minify/libraries/terser
216743732
ns/iter (± 625518
)240845266
ns/iter (± 8559171
)0.90
es/minify/libraries/three
360358753
ns/iter (± 3117883
)421388584
ns/iter (± 6999588
)0.86
es/minify/libraries/typescript
2711641352
ns/iter (± 24721039
)2913831474
ns/iter (± 29123005
)0.93
es/minify/libraries/victory
561586712
ns/iter (± 5231270
)726810287
ns/iter (± 22853968
)0.77
es/minify/libraries/vue
120808843
ns/iter (± 374035
)126931774
ns/iter (± 3676179
)0.95
es/visitor/compare/clone
1707148
ns/iter (± 7815
)1728206
ns/iter (± 12213
)0.99
es/visitor/compare/visit_mut_span
2049958
ns/iter (± 12369
)2090080
ns/iter (± 25475
)0.98
es/visitor/compare/visit_mut_span_panic
2047803
ns/iter (± 52641
)2084262
ns/iter (± 11733
)0.98
es/visitor/compare/fold_span
2777711
ns/iter (± 6751
)2831836
ns/iter (± 14039
)0.98
es/visitor/compare/fold_span_panic
2804818
ns/iter (± 8888
)2881987
ns/iter (± 10009
)0.97
es/lexer/colors
9480
ns/iter (± 85
)9387
ns/iter (± 70
)1.01
es/lexer/angular
4913368
ns/iter (± 68772
)4882527
ns/iter (± 37025
)1.01
es/lexer/backbone
647451
ns/iter (± 2033
)634496
ns/iter (± 9494
)1.02
es/lexer/jquery
3750257
ns/iter (± 21936
)3677202
ns/iter (± 7965
)1.02
es/lexer/jquery mobile
5278639
ns/iter (± 118597
)5293844
ns/iter (± 16815
)1.00
es/lexer/mootools
2829153
ns/iter (± 6290
)2890028
ns/iter (± 48916
)0.98
es/lexer/underscore
541301
ns/iter (± 1481
)536675
ns/iter (± 1144
)1.01
es/lexer/three
16057144
ns/iter (± 48678
)16250513
ns/iter (± 111407
)0.99
es/lexer/yui
3044275
ns/iter (± 32337
)2849974
ns/iter (± 5241
)1.07
es/lexer/cal-com
13292557
ns/iter (± 107050
)13147498
ns/iter (± 98228
)1.01
es/lexer/typescript
93590774
ns/iter (± 834164
)94250171
ns/iter (± 726624
)0.99
es/parser/colors
23520
ns/iter (± 112
)23620
ns/iter (± 60
)1.00
es/parser/angular
12596460
ns/iter (± 180045
)12908302
ns/iter (± 216169
)0.98
es/parser/backbone
1830334
ns/iter (± 17557
)1819739
ns/iter (± 5954
)1.01
es/parser/jquery
10107657
ns/iter (± 82501
)10243780
ns/iter (± 187543
)0.99
es/parser/jquery mobile
15408520
ns/iter (± 241218
)15632117
ns/iter (± 138604
)0.99
es/parser/mootools
7846023
ns/iter (± 22427
)7968342
ns/iter (± 41819
)0.98
es/parser/underscore
1601277
ns/iter (± 6686
)1595909
ns/iter (± 9262
)1.00
es/parser/three
45373379
ns/iter (± 791117
)45962006
ns/iter (± 982007
)0.99
es/parser/yui
7453951
ns/iter (± 27211
)7456901
ns/iter (± 117778
)1.00
es/parser/cal-com
41592419
ns/iter (± 544089
)42144574
ns/iter (± 569423
)0.99
es/parser/typescript
271659978
ns/iter (± 1697016
)276738464
ns/iter (± 3192106
)0.98
es/preset-env/usage/builtin_type
137201
ns/iter (± 33895
)138226
ns/iter (± 33534
)0.99
es/preset-env/usage/property
16366
ns/iter (± 78
)17616
ns/iter (± 143
)0.93
es/resolver/typescript
98785136
ns/iter (± 2193785
)104402449
ns/iter (± 2279347
)0.95
es/fixer/typescript
77924761
ns/iter (± 4141923
)82721425
ns/iter (± 2785561
)0.94
es/hygiene/typescript
183575176
ns/iter (± 3244170
)190348197
ns/iter (± 3851904
)0.96
es/resolver_with_hygiene/typescript
303635285
ns/iter (± 6617988
)319020439
ns/iter (± 5635033
)0.95
es/visitor/base-perf/module_clone
55979
ns/iter (± 398
)56642
ns/iter (± 498
)0.99
es/visitor/base-perf/fold_empty
59513
ns/iter (± 914
)59913
ns/iter (± 724
)0.99
es/visitor/base-perf/fold_noop_impl_all
59819
ns/iter (± 860
)59871
ns/iter (± 880
)1.00
es/visitor/base-perf/fold_noop_impl_vec
60156
ns/iter (± 1079
)59692
ns/iter (± 648
)1.01
es/visitor/base-perf/boxing_boxed_clone
60
ns/iter (± 0
)60
ns/iter (± 0
)1
es/visitor/base-perf/boxing_unboxed_clone
47
ns/iter (± 0
)47
ns/iter (± 0
)1
es/visitor/base-perf/boxing_boxed
105
ns/iter (± 0
)105
ns/iter (± 1
)1
es/visitor/base-perf/boxing_unboxed
81
ns/iter (± 0
)82
ns/iter (± 0
)0.99
es/visitor/base-perf/visit_contains_this
2642
ns/iter (± 35
)2627
ns/iter (± 46
)1.01
es/base/parallel/resolver/typescript
2300766543
ns/iter (± 149922368
)2662199161
ns/iter (± 140752733
)0.86
es/base/parallel/hygiene/typescript
3219487164
ns/iter (± 48151573
)3409978863
ns/iter (± 51603757
)0.94
babelify-only
494374
ns/iter (± 17605
)497291
ns/iter (± 5436
)0.99
parse_and_babelify_angular
42378886
ns/iter (± 709520
)39709218
ns/iter (± 2472568
)1.07
parse_and_babelify_backbone
4377755
ns/iter (± 56767
)4365349
ns/iter (± 92937
)1.00
parse_and_babelify_jquery
28442861
ns/iter (± 380635
)28766150
ns/iter (± 309415
)0.99
parse_and_babelify_jquery_mobile
50286844
ns/iter (± 802010
)51352103
ns/iter (± 2803304
)0.98
parse_and_babelify_mootools
25647772
ns/iter (± 188285
)26121763
ns/iter (± 229065
)0.98
parse_and_babelify_underscore
3715512
ns/iter (± 11606
)3669482
ns/iter (± 20035
)1.01
parse_and_babelify_yui
23834010
ns/iter (± 851302
)24298944
ns/iter (± 248841
)0.98
html/minify/document/css_spec
46794606
ns/iter (± 278661
)47251719
ns/iter (± 595231
)0.99
html/minify/document/github
18544186
ns/iter (± 185813
)18393028
ns/iter (± 329081
)1.01
html/minify/document/stackoverflow
16731014
ns/iter (± 325887
)16662719
ns/iter (± 758246
)1.00
html/minify/document_fragment/css_spec
44736192
ns/iter (± 350183
)44313062
ns/iter (± 199996
)1.01
html/minify/document_fragment/github
17946492
ns/iter (± 139044
)17962012
ns/iter (± 45508
)1.00
html/minify/document_fragment/stackoverflow
16652246
ns/iter (± 58685
)16331340
ns/iter (± 165477
)1.02
html/document/visitor/compare/clone
167797
ns/iter (± 1918
)167204
ns/iter (± 1941
)1.00
html/document/visitor/compare/visit_mut_span
181835
ns/iter (± 699
)183179
ns/iter (± 2963
)0.99
html/document/visitor/compare/visit_mut_span_panic
191305
ns/iter (± 6444
)186801
ns/iter (± 442
)1.02
html/document/visitor/compare/fold_span
227185
ns/iter (± 1908
)231660
ns/iter (± 1082
)0.98
html/document/visitor/compare/fold_span_panic
283535
ns/iter (± 1780
)276823
ns/iter (± 753
)1.02
html/document_fragment/visitor/compare/clone
168588
ns/iter (± 554
)166545
ns/iter (± 942
)1.01
html/document_fragment/visitor/compare/visit_mut_span
184205
ns/iter (± 1134
)183070
ns/iter (± 1092
)1.01
html/document_fragment/visitor/compare/visit_mut_span_panic
187872
ns/iter (± 1405
)189401
ns/iter (± 1790
)0.99
html/document_fragment/visitor/compare/fold_span
229698
ns/iter (± 1195
)230544
ns/iter (± 1214
)1.00
html/document_fragment/visitor/compare/fold_span_panic
280877
ns/iter (± 1957
)283048
ns/iter (± 1329
)0.99
html/lexer/css_2021_spec
12820021
ns/iter (± 30222
)12775580
ns/iter (± 85025
)1.00
html/lexer/github_com_17_05_2022
4915079
ns/iter (± 34333
)4909491
ns/iter (± 28744
)1.00
html/lexer/stackoverflow_com_17_05_2022
4668399
ns/iter (± 29563
)4673112
ns/iter (± 42666
)1.00
html/parser/parser_document/css_2021_spec
25979649
ns/iter (± 170288
)25572001
ns/iter (± 275804
)1.02
html/parser/parser_document/github_com_17_05_2022
8487959
ns/iter (± 219225
)8479603
ns/iter (± 24880
)1.00
html/parser/parser_document/stackoverflow_com_17_05_2022
7475187
ns/iter (± 162307
)7467099
ns/iter (± 50552
)1.00
html/parser/parser_document_fragment/css_2021_spec
25249337
ns/iter (± 43584
)25148434
ns/iter (± 55767
)1.00
html/parser/parser_document_fragment/github_com_17_05_2022
8436042
ns/iter (± 11499
)8459539
ns/iter (± 13820
)1.00
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022
7403625
ns/iter (± 29885
)7420591
ns/iter (± 15160
)1.00
This comment was automatically generated by workflow using github-action-benchmark.