Skip to content

Commit 6482f7b

Browse files
committed
chore: Test cov
1 parent 848a1ff commit 6482f7b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

jestconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"moduleDirectories": ["node_modules", "src"],
55
"moduleFileExtensions": ["ts", "js", "json"],
66
"roots": ["<rootDir>"],
7-
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
7+
"testMatch": ["<rootDir>/src/**/*.test.ts", "<rootDir>/test/**/*.test.ts"],
88
"collectCoverage": true,
99
"collectCoverageFrom": [
1010
"src/**/*.ts",

src/service.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { printTable } from 'console-table-printer';
1+
import { Table } from 'console-table-printer';
22

33
import { verifyInput, verifyTableOptions } from './inputVerifier';
44

@@ -36,11 +36,13 @@ const printTableFromInp = (inp: string, tableOptions?: string): void | string =>
3636
const { data, options } = parsed;
3737

3838
console.log(options);
39-
if (options) {
40-
printTable(data, options);
41-
} else {
42-
printTable(data);
39+
const table = new Table(options);
40+
41+
if (Array.isArray(data) && data.length > 0) {
42+
data.forEach(row => table.addRow(row));
4343
}
44+
45+
table.printTable();
4446
};
4547

4648
export default printTableFromInp;

0 commit comments

Comments
 (0)