Skip to content

Commit

Permalink
feat: add vitest configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rsaz committed Apr 28, 2024
1 parent 54f81b7 commit c1e4521
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 16 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
bin/
5 changes: 3 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ module.exports = {
jest: true,
},
ignorePatterns: [
"./bin/*",
"bin/*",
"node_modules/*",
"expressots.config.ts",
"commitlint.config.ts",
"./vitest.config.ts",
"vitest.config.ts",
".eslintrc.cjs",
],
rules: {
"@typescript-eslint/interface-name-prefix": "off",
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"lint": "eslint \"./src/**/*.ts\"",
"lint:fix": "eslint \"./src/**/*.ts\" --fix",
"release": "release-it",
"test": "vitest run --report default",
"test": "vitest run --reporter default",
"test:watch": "vitest",
"coverage": "vitest run --coverage"
},
Expand Down Expand Up @@ -79,11 +79,12 @@
"eslint-config-prettier": "9.1.0",
"husky": "9.0.11",
"prettier": "3.2.5",
"reflect-metadata": "0.2.2",
"release-it": "16.3.0",
"typescript": "5.2.2",
"rimraf": "5.0.5",
"shx": "^0.3.4",
"ts-node-dev": "^2.0.0",
"shx": "0.3.4",
"ts-node-dev": "2.0.0",
"typescript": "5.2.2",
"vite": "5.2.8",
"vite-tsconfig-paths": "4.3.2",
"vitest": "1.4.0"
Expand Down
7 changes: 7 additions & 0 deletions src/commands/__tests__/project.commands.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { describe, it, expect } from "vitest";

describe("project.commands", () => {
it("should return a list of commands", () => {
expect(true).toBe(true);
});
});
7 changes: 5 additions & 2 deletions src/generate/utils/command-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,11 @@ export const splitTarget = async ({
const isCamelCase = camelCaseRegex.test(name);
const isKebabCase = kebabCaseRegex.test(name);
if (isCamelCase || isKebabCase) {
const [wordName, ...path] = name ? name.split(isCamelCase ? /(?=[A-Z])/ : kebabCaseRegex)
.map((word) => word.toLowerCase()) : [];
const [wordName, ...path] = name
? name
.split(isCamelCase ? /(?=[A-Z])/ : kebabCaseRegex)
.map((word) => word.toLowerCase())
: [];

return {
path: `${wordName}/${pathEdgeCase(path)}${pathEdgeCase(
Expand Down
2 changes: 1 addition & 1 deletion src/generate/utils/opinionated-cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function opinionatedProcess(
method,
f.file,
);

const u = await validateAndPrepareFile({
schematic: "usecase",
target,
Expand Down
8 changes: 4 additions & 4 deletions src/providers/prisma/prisma.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ const prismaProvider = async (
)
? "npm"
: fs.existsSync("yarn.lock")
? "yarn"
: fs.existsSync("pnpm-lock.yaml")
? "pnpm"
: null;
? "yarn"
: fs.existsSync("pnpm-lock.yaml")
? "pnpm"
: null;

if (packageManager) {
// Install prisma in the project
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": false,
"target": "ES2017",
"lib": ["ES2017"],
"target": "ES2021",
"lib": ["ES2021"],
"outDir": "bin",
"sourceMap": false,
"strictNullChecks": false,
"strict": true,
"skipLibCheck": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"types": ["node", "vitest/globals"]
"types": ["node", "reflect-metadata", "vitest/globals"]
},
"include": ["./src/**/*.ts"],
"exclude": ["node_modules", "test/**/*.spec.ts", "./bin/**/*"]
Expand Down

0 comments on commit c1e4521

Please sign in to comment.