Skip to content

Commit f400382

Browse files
committed
ascii-cli-8: bump version, improve test
1 parent 14614d3 commit f400382

File tree

5 files changed

+751
-178
lines changed

5 files changed

+751
-178
lines changed

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simple-ascii-chart-cli",
3-
"version": "1.2.0",
3+
"version": "2.0.0",
44
"description": "Simple ascii chart generator CLI",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -19,17 +19,17 @@
1919
},
2020
"devDependencies": {
2121
"@types/jest": "^29.5.14",
22-
"@types/node": "^22.8.1",
23-
"@typescript-eslint/eslint-plugin": "^8.11.0",
24-
"@typescript-eslint/parser": "^8.11.0",
25-
"eslint": "^9.13.0",
26-
"eslint-config-prettier": "^9.1.0",
22+
"@types/node": "^22.15.17",
23+
"@typescript-eslint/eslint-plugin": "^8.32.0",
24+
"@typescript-eslint/parser": "^8.32.0",
25+
"eslint": "^9.26.0",
26+
"eslint-config-prettier": "^10.1.5",
2727
"eslint-plugin-import": "^2.31.0",
2828
"jest": "^29.7.0",
29-
"prettier": "^3.3.3",
30-
"ts-jest": "^29.2.5",
31-
"tsc-watch": "^6.2.0",
32-
"typescript": "^5.6.3"
29+
"prettier": "^3.5.3",
30+
"ts-jest": "^29.3.2",
31+
"tsc-watch": "^6.2.1",
32+
"typescript": "^5.8.3"
3333
},
3434
"keywords": [
3535
"ascii",
@@ -52,7 +52,7 @@
5252
"dist/**/*"
5353
],
5454
"dependencies": {
55-
"simple-ascii-chart": "^4.2.0",
55+
"simple-ascii-chart": "^5.0.0",
5656
"yargs": "^17.7.2"
5757
}
5858
}

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Import necessary modules and types
44
import * as yargs from 'yargs';
55
import plot from 'simple-ascii-chart';
6-
import { MultiLine, Settings } from 'simple-ascii-chart/dist/types';
6+
import { MultiLine, Settings } from 'simple-ascii-chart';
77
import {
88
validateFormatter,
99
validateLineFormatter,

src/tests/cli.test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { exec } from 'child_process';
2+
import path from 'path';
23

3-
describe('plotter script', () => {
4-
// @ts-expect-error tests
5-
const execPlotterScript = (args, callback) => {
6-
exec(`node node_modules/simple-ascii-chart/dist/cli.js ${args}`, callback);
7-
};
4+
const cliPath = path.resolve(__dirname, '../../dist/cli.js'); // <-- LOCAL build output
5+
6+
function execPlotterScript(
7+
args: string,
8+
callback: (error: Error | null, stdout: string, stderr: string) => void,
9+
) {
10+
exec(`node ${cliPath} ${args}`, callback);
11+
}
812

13+
describe('plotter script', () => {
914
it('should require the --input option', (done) => {
10-
// @ts-expect-error tests
1115
execPlotterScript('', (error, stdout, stderr) => {
1216
expect(stderr).toContain('Missing required argument: input');
1317
done();
@@ -20,7 +24,7 @@ describe('plotter script', () => {
2024
[2, 2],
2125
[3, 3],
2226
]);
23-
// @ts-expect-error tests
27+
2428
execPlotterScript(`--input '${validInput}'`, (error, stdout, stderr) => {
2529
expect(error).toBeNull();
2630
expect(stderr).toBe('');
@@ -38,7 +42,7 @@ describe('plotter script', () => {
3842

3943
it('should handle invalid JSON input gracefully', (done) => {
4044
const invalidInput = '[ invalid json';
41-
// @ts-expect-error tests
45+
4246
execPlotterScript(`--input '${invalidInput}'`, (error, stdout, stderr) => {
4347
expect(stderr).toContain('Oops! Something went wrong!');
4448
done();

src/validators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
MaybePoint,
99
Symbols,
1010
Threshold,
11-
} from 'simple-ascii-chart/dist/types';
11+
} from 'simple-ascii-chart';
1212

1313
// Prepares parameters by parsing JSON inputs and merging with optional settings
1414
// Define ANSI color types for validation

0 commit comments

Comments
 (0)