Skip to content

Commit

Permalink
Distinguish node execution flow for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlacenka committed May 16, 2024
1 parent 5d7d10a commit f5688b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
collectCoverageFrom: ["src/**/*.ts"],
};
31 changes: 17 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ export function sum(numbers: number[]): number {
return numbers.reduce((acc, value) => acc + value, 0);
}

const MONDAY_COUNT = 1;
const TUESDAY_COUNT = 2;
const WEDNESDAY_COUNT = 3;
const THURSDAY_COUNT = 4;
const FRIDAY_COUNT = 5;
// eslint-disable-next-line unicorn/prefer-module
if (require.main === module) {
const MONDAY_COUNT = 1;
const TUESDAY_COUNT = 2;
const WEDNESDAY_COUNT = 3;
const THURSDAY_COUNT = 4;
const FRIDAY_COUNT = 5;

console.info(
sum([
MONDAY_COUNT,
TUESDAY_COUNT,
WEDNESDAY_COUNT,
THURSDAY_COUNT,
FRIDAY_COUNT,
]),
);
console.info(
sum([
MONDAY_COUNT,
TUESDAY_COUNT,
WEDNESDAY_COUNT,
THURSDAY_COUNT,
FRIDAY_COUNT,
]),
);
}

0 comments on commit f5688b2

Please sign in to comment.