From c2f40b600f83d949432380abaa3c845987e3c9a6 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:34:09 +0000 Subject: [PATCH] build: fix TypeScript configuration for test files Co-Authored-By: Michael Latman --- jest.config.mjs | 8 ++++++-- package.json | 2 +- tsconfig.build.json | 11 +++++++++++ tsconfig.json | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 tsconfig.build.json diff --git a/jest.config.mjs b/jest.config.mjs index 147030c..cdd6cc6 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -14,8 +14,12 @@ const config = { }, ], }, - testMatch: ['**/__tests__/**/*.test.ts'], - testPathIgnorePatterns: ['/node_modules/', '/loaders/'], + roots: ['/src', '/test'], + testMatch: [ + '**/__tests__/**/*.ts', + '**/test/**/*.test.ts' + ], + testPathIgnorePatterns: ['/node_modules/', '/loaders/', 'setup.ts'], }; export default config; \ No newline at end of file diff --git a/package.json b/package.json index 8ddb537..e27395e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A NPX command to install and list packages", "main": "dist/index.js", "scripts": { - "build": "tsc && chmod +x dist/index.js", + "build": "tsc --project tsconfig.build.json && chmod +x dist/index.js", "start": "node dist/index.js", "test": "NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.mjs", "test:list": "node --loader ts-node/esm src/index.ts list", diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..2efd5b7 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "dist" + }, + "exclude": [ + "test", + "**/__tests__/**" + ] +} diff --git a/tsconfig.json b/tsconfig.json index a7552e9..d38773d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,7 @@ "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "outDir": "./dist", - "rootDir": "./src", + "rootDir": ".", "types": ["node", "jest"] }, "include": ["src/**/*", "test/**/*"],