Skip to content

Commit

Permalink
feat: add test dir ESLint & update Jest config for improved testing s…
Browse files Browse the repository at this point in the history
…tructure
  • Loading branch information
rsaz committed Nov 19, 2024
1 parent 4f5c54d commit fc3f48d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
".eslintrc.cjs",
"coverage/*",
"scripts/*",
"test/**/*.spec.ts",
],
rules: {
"@typescript-eslint/interface-name-prefix": "off",
Expand Down
36 changes: 18 additions & 18 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import type { JestConfigWithTsJest } from "ts-jest";

const config: JestConfigWithTsJest = {
testEnvironment: "node",
roots: ["<rootDir>/src"],
testRegex: ".*\\.spec\\.ts$",
testPathIgnorePatterns: ["/node_modules/", "/bin/"],
collectCoverageFrom: ["src/**/*.ts", "!**/*.spec.ts", "src/**/index.ts"],
moduleNameMapper: {
"^@src/(.*)$": "<rootDir>/src/$1",
},
setupFiles: ["reflect-metadata"],
transform: {
"^.+\\.ts$": [
"ts-jest",
{
tsconfig: "tsconfig.json",
// Add any ts-jest specific options here
},
],
},
testEnvironment: "node",
roots: ["<rootDir>/src", "<rootDir>/test"],
testRegex: ".*\\.spec\\.ts$",
testPathIgnorePatterns: ["/node_modules/", "/bin/"],
collectCoverageFrom: ["src/**/*.ts", "!**/*.spec.ts", "src/**/index.ts"],
moduleNameMapper: {
"^@src/(.*)$": "<rootDir>/src/$1",
},
setupFiles: ["reflect-metadata"],
transform: {
"^.+\\.ts$": [
"ts-jest",
{
tsconfig: "tsconfig.json",
// Add any ts-jest specific options here
},
],
},
};

export default config;
6 changes: 4 additions & 2 deletions test/test.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
it("pass", () => {
expect(true).toBe(true);
describe("Test", () => {
it("pass", () => {
expect(true).toBe(true);
});
});

0 comments on commit fc3f48d

Please sign in to comment.