1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-02-03 23:58:44 +00:00
_/jest
dependabot[bot] d6b110edb8
Bump decode-uri-component from 0.2.0 to 0.2.2 in /jest
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 21:43:58 +00:00
..
.gitignore create jest 2021-04-13 18:37:49 +09:00
add.js create jest 2021-04-13 18:37:49 +09:00
add.test.js create jest 2021-04-13 18:37:49 +09:00
foo.js create jest 2021-04-13 18:37:49 +09:00
foo.test.js create jest 2021-04-13 18:37:49 +09:00
package.json create jest 2021-04-13 18:37:49 +09:00
README.md create jest 2021-04-13 18:37:49 +09:00
yarn.lock Bump decode-uri-component from 0.2.0 to 0.2.2 in /jest 2022-12-08 21:43:58 +00:00

何をしたかったか

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 % になった。