Skip to content

Commit

Permalink
test(html/parser): Refactor tests to make git faster (#6158)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Oct 18, 2022
1 parent d34cdd2 commit a4acc7a
Show file tree
Hide file tree
Showing 10,532 changed files with 97,833 additions and 97,516 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
120 changes: 61 additions & 59 deletions crates/swc_html_codegen/tests/fixture.rs
Expand Up @@ -572,69 +572,69 @@ fn parser_recovery_verify(input: PathBuf) {

// Tag omission only works for valid HTML documents (i.e. without errors)
static IGNORE_TAG_OMISSION: &[&str] = &[
"adoption01_dat/5/input.html",
"adoption01_dat/6/input.html",
"adoption01_dat/7/input.html",
"adoption01_dat/8/input.html",
"adoption02_dat/0/input.html",
"tests1_dat/68/input.html",
"tests1_dat/69/input.html",
"tests1_dat/70/input.html",
"tests1_dat/71/input.html",
"tests15_dat/0/input.html",
"tests15_dat/1/input.html",
"template_dat/68/input.html",
"tricky01_dat/6/input.html",
"adoption01_dat.5.html",
"adoption01_dat.6.html",
"adoption01_dat.7.html",
"adoption01_dat.8.html",
"adoption02_dat.0.html",
"tests1_dat.68.html",
"tests1_dat.69.html",
"tests1_dat.70.html",
"tests1_dat.71.html",
"tests15_dat.0.html",
"tests15_dat.1.html",
"template_dat.68.html",
"tricky01_dat.6.html",
];

#[testing::fixture(
"../swc_html_parser/tests/html5lib-tests-fixture/**/*.html",
exclude(
"tests1_dat/30/input.html",
"tests1_dat/77/input.html",
"tests1_dat/90/input.html",
"tests1_dat/103/input.html",
"tests2_dat/12/input.html",
"tests16_dat/31/input.html",
"tests16_dat/32/input.html",
"tests16_dat/33/input.html",
"tests16_dat/34/input.html",
"tests16_dat/35/input.html",
"tests16_dat/36/input.html",
"tests16_dat/37/input.html",
"tests16_dat/48/input.html",
"tests16_dat/49/input.html",
"tests16_dat/50/input.html",
"tests16_dat/51/input.html",
"tests16_dat/52/input.html",
"tests16_dat/53/input.html",
"tests16_dat/130/input.html",
"tests16_dat/131/input.html",
"tests16_dat/132/input.html",
"tests16_dat/133/input.html",
"tests16_dat/134/input.html",
"tests16_dat/135/input.html",
"tests16_dat/136/input.html",
"tests16_dat/147/input.html",
"tests16_dat/148/input.html",
"tests16_dat/149/input.html",
"tests16_dat/150/input.html",
"tests16_dat/196/input.html",
"tests18_dat/7/input.html",
"tests18_dat/8/input.html",
"tests18_dat/9/input.html",
"tests18_dat/12/input.html",
"tests18_dat/21/input.html",
"tests19_dat/103/input.html",
"tests20_dat/42/input.html",
"tests26_dat/2/input.html",
"plain-text-unsafe_dat/0/input.html",
"template_dat/107/input.html",
"tests1_dat.30.html",
"tests1_dat.77.html",
"tests1_dat.90.html",
"tests1_dat.103.html",
"tests2_dat.12.html",
"tests16_dat.31.html",
"tests16_dat.32.html",
"tests16_dat.33.html",
"tests16_dat.34.html",
"tests16_dat.35.html",
"tests16_dat.36.html",
"tests16_dat.37.html",
"tests16_dat.48.html",
"tests16_dat.49.html",
"tests16_dat.50.html",
"tests16_dat.51.html",
"tests16_dat.52.html",
"tests16_dat.53.html",
"tests16_dat.130.html",
"tests16_dat.131.html",
"tests16_dat.132.html",
"tests16_dat.133.html",
"tests16_dat.134.html",
"tests16_dat.135.html",
"tests16_dat.136.html",
"tests16_dat.147.html",
"tests16_dat.148.html",
"tests16_dat.149.html",
"tests16_dat.150.html",
"tests16_dat.196.html",
"tests18_dat.7.html",
"tests18_dat.8.html",
"tests18_dat.9.html",
"tests18_dat.12.html",
"tests18_dat.21.html",
"tests19_dat.103.html",
"tests20_dat.42.html",
"tests26_dat.2.html",
"plain-text-unsafe_dat.0.html",
"template_dat.107.html",
)
)]
fn html5lib_tests_verify(input: PathBuf) {
let parent = input.parent().unwrap().to_string_lossy();
let scripting_enabled = parent.contains("script_on");
let file_name = input.file_name().unwrap().to_string_lossy();
let scripting_enabled = file_name.contains("script_on");
let parser_config = ParserConfig {
scripting_enabled,
iframe_srcdoc: false,
Expand All @@ -657,12 +657,14 @@ fn html5lib_tests_verify(input: PathBuf) {
..Default::default()
};

if parent.contains("fragment") {
if file_name.contains("fragment") {
let mut context_element_namespace = Namespace::HTML;
let mut context_element_tag_name = "";
let context_element = parent
.split('.')
.last()
let mut splitted = file_name.split('.');
let index = splitted.clone().count() - 2;

let context_element = splitted
.nth(index)
.expect("failed to get context element from filename")
.replace("fragment_", "");

Expand Down

1 comment on commit a4acc7a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: a4acc7a Previous: 7a38fde Ratio
es/full/minify/libraries/antd 1909597719 ns/iter (± 53347292) 1832264779 ns/iter (± 26573201) 1.04
es/full/minify/libraries/d3 433130176 ns/iter (± 25176552) 404751114 ns/iter (± 24224896) 1.07
es/full/minify/libraries/echarts 1753659822 ns/iter (± 84140472) 1593717215 ns/iter (± 45601964) 1.10
es/full/minify/libraries/jquery 106717014 ns/iter (± 4167257) 105526324 ns/iter (± 5910146) 1.01
es/full/minify/libraries/lodash 122953984 ns/iter (± 10876829) 143871380 ns/iter (± 22775796) 0.85
es/full/minify/libraries/moment 60073411 ns/iter (± 5602582) 93852280 ns/iter (± 51332303) 0.64
es/full/minify/libraries/react 20460327 ns/iter (± 1403960) 22476718 ns/iter (± 849475) 0.91
es/full/minify/libraries/terser 301614761 ns/iter (± 10522920) 373633083 ns/iter (± 15467545) 0.81
es/full/minify/libraries/three 548762534 ns/iter (± 16047860) 612301692 ns/iter (± 46966500) 0.90
es/full/minify/libraries/typescript 3457348762 ns/iter (± 558271844) 3578813848 ns/iter (± 135613788) 0.97
es/full/minify/libraries/victory 874350916 ns/iter (± 56319603) 855505991 ns/iter (± 77620340) 1.02
es/full/minify/libraries/vue 151179525 ns/iter (± 9793157) 176256702 ns/iter (± 12413543) 0.86
es/full/codegen/es3 38741 ns/iter (± 5939) 34381 ns/iter (± 1352) 1.13
es/full/codegen/es5 49259 ns/iter (± 7667) 34595 ns/iter (± 2404) 1.42
es/full/codegen/es2015 37237 ns/iter (± 7307) 34400 ns/iter (± 2170) 1.08
es/full/codegen/es2016 43224 ns/iter (± 8500) 36042 ns/iter (± 29512) 1.20
es/full/codegen/es2017 40353 ns/iter (± 8037) 37312 ns/iter (± 10317) 1.08
es/full/codegen/es2018 35040 ns/iter (± 4843) 34417 ns/iter (± 1138) 1.02
es/full/codegen/es2019 36147 ns/iter (± 4502) 34093 ns/iter (± 1730) 1.06
es/full/codegen/es2020 36524 ns/iter (± 5276) 34425 ns/iter (± 3063) 1.06
es/full/all/es3 203398641 ns/iter (± 15810554) 214741877 ns/iter (± 37064591) 0.95
es/full/all/es5 193367542 ns/iter (± 20017270) 195822870 ns/iter (± 16247609) 0.99
es/full/all/es2015 151886487 ns/iter (± 14029725) 155090964 ns/iter (± 11013410) 0.98
es/full/all/es2016 169033923 ns/iter (± 21125912) 156082469 ns/iter (± 9342338) 1.08
es/full/all/es2017 175591754 ns/iter (± 23432186) 153013247 ns/iter (± 9197242) 1.15
es/full/all/es2018 165901126 ns/iter (± 27962451) 162983817 ns/iter (± 17288485) 1.02
es/full/all/es2019 170486310 ns/iter (± 21513715) 182815746 ns/iter (± 18724098) 0.93
es/full/all/es2020 154737318 ns/iter (± 13425932) 155555979 ns/iter (± 13591650) 0.99
es/full/parser 805762 ns/iter (± 136190) 738495 ns/iter (± 42463) 1.09
es/full/base/fixer 31050 ns/iter (± 4414) 26995 ns/iter (± 1929) 1.15
es/full/base/resolver_and_hygiene 98035 ns/iter (± 13250) 94334 ns/iter (± 7712) 1.04
serialization of ast node 232 ns/iter (± 49) 207 ns/iter (± 11) 1.12
serialization of serde 225 ns/iter (± 41) 211 ns/iter (± 5) 1.07

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.