This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test-tree-shaking.bats
81 lines (64 loc) · 2.61 KB
/
test-tree-shaking.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
@test "parcel bundle should include necessary code (no tree-shaking)" {
run grep -q span dist/Example.bs.js
[ "$status" -eq 0 ]
run grep -q "hello" dist/Example.bs.js
[ "$status" -eq 0 ]
}
@test "parcel bundle should include unnecessary code (no tree-shaking)" {
run grep -q blockquote dist/Example.bs.js
[ "$status" -eq 0 ]
}
@test "webpack bundle should include necessary code (tree-shaking)" {
# This is the variant from Css_Selector.Element.tToJs
run grep -q "[-866592054,\"span\"]" dist/bundle.webpack.js
[ "$status" -eq 0 ]
# This is the constructor for span elements
run grep -q "\"span\",Object.assign" dist/bundle.webpack.js
[ "$status" -eq 0 ]
run grep -q "hello" dist/bundle.webpack.js
[ "$status" -eq 0 ]
}
@test "webpack bundle should disclude unnecessary code (tree-shaking)" {
# This is the variant from Css_Selector.Element.tToJs
run grep -q "[573069007,\"blockquote\"]" dist/bundle.webpack.js
[ "$status" -eq 0 ]
# This is the constructor for blockquote elements
run grep -q "\"blockquote\",Object.assign" dist/bundle.webpack.js
[ "$status" -eq 1 ]
}
@test "webpack jsx bundle should include necessary code (tree-shaking)" {
# This is the variant from Css_Selector.Element.tToJs
run grep -q "[-866592054,\"span\"]" dist/bundle.webpack.jsx.js
[ "$status" -eq 0 ]
# This is the constructor for span elements
run grep -q "\"span\",Object.assign" dist/bundle.webpack.jsx.js
[ "$status" -eq 0 ]
run grep -q "Hello, world!" dist/bundle.webpack.jsx.js
[ "$status" -eq 0 ]
}
@test "webpack jsx bundle should disclude unnecessary code (tree-shaking)" {
# This is the variant from Css_Selector.Element.tToJs
run grep -q "[573069007,\"blockquote\"]" dist/bundle.webpack.jsx.js
[ "$status" -eq 0 ]
# This is the constructor for blockquote elements
run grep -q "\"blockquote\",Object.assign" dist/bundle.webpack.jsx.js
[ "$status" -eq 1 ]
}
@test "rollup bundle should include necessary code (tree-shaking)" {
# This is the variant from Css_Selector.Element.tToJs
run grep -q "\"span\"" dist/bundle.rollup.js
[ "$status" -eq 0 ]
# This is the constructor for span elements
run grep -q "\"span\", Object.assign" dist/bundle.rollup.js
[ "$status" -eq 0 ]
run grep -q "hello" dist/bundle.rollup.js
[ "$status" -eq 0 ]
}
@test "rollup bundle should disclude unnecessary code (tree-shaking)" {
# This is the variant from Css_Selector.Element.tToJs
run grep -q "\"blockquote\"" dist/bundle.rollup.js
[ "$status" -eq 0 ]
# This is the constructor for blockquote elements
run grep -q "\"blockquote\", Object.assign" dist/bundle.rollup.js
[ "$status" -eq 1 ]
}