Skip to content

Commit 71f64ca

Browse files
committed
chore(cli): replace tets by vitest
1 parent 31639a9 commit 71f64ca

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

cli/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@
2424
"nyc": "^15.1.0",
2525
"sinon": "^19.0.2",
2626
"ts-loader": "*",
27+
"vitest": "*",
2728
"ts-mocha": "^10.0.0",
2829
"ts-node": "^10.9.2"
2930
},
3031
"scripts": {
31-
"compile": "rm -rf build/ && tsc && cp index.js build/",
32+
"compile": "npm run clean && tsc && cp index.js build/",
3233
"watch": "webpack --watch",
33-
"clean": "rm -rf out/ dist/ types/",
34+
"clean": "rm -rf build/ out/ dist/ types/",
3435
"compile-tests": "npm run clean && tsc -p . --outDir out",
3536
"watch-tests": "tsc -p . -w --outDir out",
3637
"lint": "eslint . --ext ts",
37-
"test": "rm -rf smelly-report.html && ts-mocha -p tsconfig.json ./**/**.test.ts",
38+
"test": "rm -rf smelly-report.html && vitest --watch=false ./**/**.test.ts",
3839
"test:watch": "nodemon --exec 'npm run test' --watch 'src/**' --ext 'ts' --delay 5",
3940
"test:coverage": "nyc --reporter=lcov ts-mocha -p tsconfig.json ts-node/register ./**/**.test.ts",
4041
"test:mutation": "stryker run",

cli/test/cli.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
import { test, describe, expect } from 'vitest';
12
import { exec } from "child_process";
23
import { promisify } from "util";
3-
import * as assert from 'assert';
44

55
const execPromise = promisify(exec);
66

77
describe('cli', () => {
88

9-
it('find no smells for a given path', async () => {
9+
test('find no smells for a given path', async () => {
1010
const { stdout } = await execPromise(`npm run cli -- fake-data/no-smells/ javascript --report=html --report-output=$(pwd)`);
1111

12-
assert.equal(true, stdout.includes("Report HTML generated"));
12+
expect(stdout).toContain("Report HTML generated");
1313
});
1414
});

cli/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
1818
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
1919
// "noUnusedParameters": true, /* Report errors on unused parameters. */
20-
}
20+
},
21+
"exclude": [
22+
"test",
23+
]
2124
}

detector/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"@types/node": "^20.14.8",
3030
"@typescript-eslint/eslint-plugin": "^5.53.0",
3131
"@typescript-eslint/parser": "^5.53.0",
32-
"@vitest/coverage-v8": "^2.1.6",
3332
"eslint": "^8.34.0",
3433
"nodemon": "^3.1.4",
3534
"ts-loader": "*",

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"typescript": "^5.2.0",
1111
"vitest": "^2.1.6",
1212
"webpack": "^5.93.0",
13-
"webpack-cli": "^5.1.4"
13+
"webpack-cli": "^5.1.4",
14+
"@vitest/coverage-v8": "^2.1.6"
1415
},
1516
"scripts": {
1617
"clean": "npm exec --workspaces -- rimraf node_modules && rimraf node_modules"

0 commit comments

Comments
 (0)