mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 22:38:06 +00:00
56dee07890
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.13.15 to 7.23.3. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.3/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.. | ||
.gitignore | ||
add.js | ||
add.test.js | ||
foo.js | ||
foo.test.js | ||
package.json | ||
README.md | ||
yarn.lock |
何をしたかったか
Jest でカバレッジを取ると行単位で結果が得られるが三項演算子などで 1 行に条件分岐があるときどうなるか検証したかった
結果
foo.test.js:
import foo from "./foo.js";
test("positive number", () => {
expect(foo(1)).toBe(1);
});
test("negative number", () => {
expect(foo(-1)).toBe(0);
});
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
add.js | 100 | 100 | 100 | 100 |
foo.js | 100 | 100 | 100 | 100 |
----------|---------|----------|---------|---------|-------------------
foo.test.js:
import foo from "./foo.js";
test("positive number", () => {
expect(foo(1)).toBe(1);
});
// test("negative number", () => {
// expect(foo(-1)).toBe(0);
// });
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 100 | 50 | 100 | 100 |
add.js | 100 | 100 | 100 | 100 |
foo.js | 100 | 50 | 100 | 100 | 2
----------|---------|----------|---------|---------|-------------------
パスを 1 つコメントアウトするとステートメントや関数、行数は 100 %のまま、Branch が 50 % になった。