Skip to content

Commit

Permalink
update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Jun 14, 2024
1 parent bfa1c4a commit 99d08e8
Show file tree
Hide file tree
Showing 13 changed files with 189 additions and 107 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"stylelint": "^16.6.1",
"stylelint-config-plus": "^1.1.2",
"supports-color": "^9.4.0",
"tsx": "^4.15.3",
"tsx": "^4.15.4",
"ws": "^8.17.0"
}
}
}
18 changes: 18 additions & 0 deletions test/mock/src/closures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function functionDefineAfterReturn(v) {

if (!v) {
foo();
return foo();
}

return v;

function foo() {
return 'Hello';
}
}


module.exports = () => {
functionDefineAfterReturn();
};
7 changes: 4 additions & 3 deletions test/mock/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const typescript = require('./typescript.ts');

const component = require('./component.js');

const { ClassWithStaticInitializationBlock } = require('./static.js');
const statics = require('./statics.js');
const closures = require('./closures.js');

function foo(argument) {
console.log('this is foo');
Expand Down Expand Up @@ -87,8 +88,8 @@ function init(stop) {
privateFunction();
}

new ClassWithStaticInitializationBlock();

statics();
closures();
}

const onload = (something) => {
Expand Down
4 changes: 2 additions & 2 deletions test/mock/src/static.js → test/mock/src/statics.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class ClassWithStaticInitializationBlock {
}
}

module.exports = {
ClassWithStaticInitializationBlock
module.exports = () => {
new ClassWithStaticInitializationBlock();
};
22 changes: 15 additions & 7 deletions test/snapshot/cli.snapshot.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"type": "v8",
"summary": {
"bytes": "54.91 %",
"statements": "59.92 %",
"branches": "52.69 %",
"functions": "55.70 %",
"lines": "47.60 %"
"bytes": "54.25 %",
"statements": "58.53 %",
"branches": "52.29 %",
"functions": "53.01 %",
"lines": "46.69 %"
},
"files": {
"test/mock/src/async.js": {
Expand All @@ -16,6 +16,14 @@
"bytes": "0.00 %",
"uncoveredLines": "1-24"
},
"test/mock/src/closures.js": {
"functions": "0.00 %",
"branches": "0.00 %",
"statements": "0.00 %",
"lines": "0.00 %",
"bytes": "0.00 %",
"uncoveredLines": "1-18"
},
"test/mock/src/comments.js": {
"functions": "",
"branches": "",
Expand All @@ -38,7 +46,7 @@
"statements": "0.00 %",
"lines": "0.00 %",
"bytes": "0.00 %",
"uncoveredLines": "1-122"
"uncoveredLines": "1-123"
},
"test/mock/src/statement.js": {
"functions": "0.00 %",
Expand All @@ -48,7 +56,7 @@
"bytes": "0.00 %",
"uncoveredLines": "1-32"
},
"test/mock/src/static.js": {
"test/mock/src/statics.js": {
"functions": "0.00 %",
"branches": "0.00 %",
"statements": "0.00 %",
Expand Down
8 changes: 4 additions & 4 deletions test/snapshot/css.snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
"lines": "39.44 %"
},
"files": {
"anonymous/style2.css": {
"anonymous/style1.css": {
"functions": "",
"branches": "",
"statements": "",
"lines": "50.00 %",
"bytes": "71.12 %",
"bytes": "70.81 %",
"uncoveredLines": "7-9"
},
"anonymous/style1.css": {
"anonymous/style2.css": {
"functions": "",
"branches": "",
"statements": "",
"lines": "50.00 %",
"bytes": "70.81 %",
"bytes": "71.12 %",
"uncoveredLines": "7-9"
},
"anonymous/style3.css": {
Expand Down
34 changes: 21 additions & 13 deletions test/snapshot/esbuild.snapshot.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"type": "v8",
"summary": {
"bytes": "81.00 %",
"statements": "83.37 %",
"branches": "59.43 %",
"functions": "83.33 %",
"lines": "70.88 %"
"bytes": "80.87 %",
"statements": "83.60 %",
"branches": "59.35 %",
"functions": "84.27 %",
"lines": "70.94 %"
},
"files": {
"src/comments.js": {
Expand Down Expand Up @@ -128,21 +128,29 @@
"bytes": "81.63 %",
"uncoveredLines": "16-22"
},
"src/static.js": {
"functions": "80.00 %",
"src/statics.js": {
"functions": "83.33 %",
"branches": "50.00 %",
"statements": "83.33 %",
"statements": "84.21 %",
"lines": "75.00 %",
"bytes": "77.83 %",
"bytes": "78.24 %",
"uncoveredLines": "9,11-13,25-27"
},
"src/closures.js": {
"functions": "100.00 %",
"branches": "50.00 %",
"statements": "90.00 %",
"lines": "69.23 %",
"bytes": "70.43 %",
"uncoveredLines": "8-12"
},
"src/index.js": {
"functions": "50.00 %",
"branches": "42.86 %",
"statements": "66.15 %",
"lines": "52.94 %",
"bytes": "63.82 %",
"uncoveredLines": "22-28,36-61,67-70,74-76,86-88,96-99,110"
"statements": "67.16 %",
"lines": "54.02 %",
"bytes": "63.77 %",
"uncoveredLines": "23-29,37-62,68-71,75-77,87-89,97-100,111"
}
}
}
29 changes: 18 additions & 11 deletions test/snapshot/istanbul.snapshot.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"type": "istanbul",
"summary": {
"lines": "82.33 %",
"statements": "82.42 %",
"functions": "75.71 %",
"branches": "58.33 %"
"lines": "82.50 %",
"statements": "82.59 %",
"functions": "77.02 %",
"branches": "58.26 %"
},
"files": {
"async.js": {
Expand Down Expand Up @@ -56,6 +56,13 @@
"branches": "40.90 %",
"uncoveredLines": "24,31-32,38,45-46,52,59-64,73-78"
},
"closures.js": {
"lines": "85.71 %",
"functions": "100.00 %",
"statements": "85.71 %",
"branches": "50.00 %",
"uncoveredLines": "8"
},
"comments.js": {
"lines": "100.00 %",
"functions": "100.00 %",
Expand Down Expand Up @@ -99,11 +106,11 @@
"uncoveredLines": "7,20"
},
"index.js": {
"lines": "70.68 %",
"lines": "71.66 %",
"functions": "53.84 %",
"statements": "71.18 %",
"statements": "72.13 %",
"branches": "57.14 %",
"uncoveredLines": "26,37-59,68-69,75,87,97-98"
"uncoveredLines": "27,38-60,69-70,76,88,98-99"
},
"statement.js": {
"lines": "100.00 %",
Expand All @@ -112,10 +119,10 @@
"branches": "100.00 %",
"uncoveredLines": ""
},
"static.js": {
"lines": "75.00 %",
"functions": "66.66 %",
"statements": "75.00 %",
"statics.js": {
"lines": "76.92 %",
"functions": "75.00 %",
"statements": "76.92 %",
"branches": "50.00 %",
"uncoveredLines": "9,12,26"
},
Expand Down
34 changes: 21 additions & 13 deletions test/snapshot/merge.snapshot.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"type": "v8",
"summary": {
"bytes": "73.78 %",
"statements": "77.38 %",
"branches": "59.59 %",
"functions": "70.97 %",
"lines": "63.64 %"
"bytes": "73.76 %",
"statements": "77.68 %",
"branches": "59.52 %",
"functions": "72.16 %",
"lines": "63.80 %"
},
"files": {
"test/mock/src/async.js": {
Expand All @@ -16,6 +16,14 @@
"bytes": "82.62 %",
"uncoveredLines": "9,14-20"
},
"test/mock/src/closures.js": {
"functions": "100.00 %",
"branches": "50.00 %",
"statements": "88.89 %",
"lines": "69.23 %",
"bytes": "70.43 %",
"uncoveredLines": "8-12"
},
"test/mock/src/comments.js": {
"functions": "",
"branches": "",
Expand All @@ -35,10 +43,10 @@
"test/mock/src/index.js": {
"functions": "53.85 %",
"branches": "57.14 %",
"statements": "70.77 %",
"lines": "56.47 %",
"bytes": "67.58 %",
"uncoveredLines": "25-27,36-61,67-70,74-76,86-88,96-99,110"
"statements": "71.64 %",
"lines": "57.47 %",
"bytes": "67.54 %",
"uncoveredLines": "26-28,37-62,68-71,75-77,87-89,97-100,111"
},
"test/mock/src/statement.js": {
"functions": "100.00 %",
Expand All @@ -48,12 +56,12 @@
"bytes": "100.00 %",
"uncoveredLines": ""
},
"test/mock/src/static.js": {
"functions": "75.00 %",
"test/mock/src/statics.js": {
"functions": "80.00 %",
"branches": "50.00 %",
"statements": "75.00 %",
"statements": "76.92 %",
"lines": "75.00 %",
"bytes": "77.83 %",
"bytes": "78.24 %",
"uncoveredLines": "9,11-13,25-27"
},
"test/mock/src/typescript.ts": {
Expand Down
34 changes: 21 additions & 13 deletions test/snapshot/puppeteer.snapshot.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"type": "v8",
"summary": {
"bytes": "73.99 %",
"statements": "82.00 %",
"branches": "59.76 %",
"functions": "78.26 %",
"lines": "63.76 %"
"bytes": "73.96 %",
"statements": "82.24 %",
"branches": "59.68 %",
"functions": "79.45 %",
"lines": "63.94 %"
},
"files": {
"test/mock/src/async.js": {
Expand All @@ -16,6 +16,14 @@
"bytes": "82.62 %",
"uncoveredLines": "9,14-20"
},
"test/mock/src/closures.js": {
"functions": "100.00 %",
"branches": "50.00 %",
"statements": "88.89 %",
"lines": "69.23 %",
"bytes": "70.43 %",
"uncoveredLines": "8-12"
},
"test/mock/src/comments.js": {
"functions": "",
"branches": "",
Expand All @@ -35,10 +43,10 @@
"test/mock/src/index.js": {
"functions": "53.85 %",
"branches": "57.14 %",
"statements": "70.77 %",
"lines": "56.47 %",
"bytes": "67.58 %",
"uncoveredLines": "25-27,36-61,67-70,74-76,86-88,96-99,110"
"statements": "71.64 %",
"lines": "57.47 %",
"bytes": "67.54 %",
"uncoveredLines": "26-28,37-62,68-71,75-77,87-89,97-100,111"
},
"test/mock/src/statement.js": {
"functions": "100.00 %",
Expand All @@ -48,12 +56,12 @@
"bytes": "100.00 %",
"uncoveredLines": ""
},
"test/mock/src/static.js": {
"functions": "75.00 %",
"test/mock/src/statics.js": {
"functions": "80.00 %",
"branches": "50.00 %",
"statements": "75.00 %",
"statements": "76.92 %",
"lines": "75.00 %",
"bytes": "77.83 %",
"bytes": "78.24 %",
"uncoveredLines": "9,11-13,25-27"
},
"test/mock/src/typescript.ts": {
Expand Down
Loading

0 comments on commit 99d08e8

Please sign in to comment.