diff --git a/.eslintrc.js b/.eslintrc.js index 4de356d..6b9328c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,7 @@ module.exports = { extends: ['@valora/eslint-config-typescript'], parserOptions: { - project: './tsconfig.eslint.json', + project: './tsconfig.test.json', }, rules: { // Maybe move it to @valora/eslint-config-typescript? diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a876ada --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + // Use the project's TypeScript version instead of the one bundled with VS Code + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/jest.config.js b/jest.config.js index af83303..e857638 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,7 +5,7 @@ module.exports = { // Allow absolute imports from the tsconfig baseUrl moduleDirectories: ['node_modules', ''], transform: { - '^.+\\.(ts|tsx)$': 'ts-jest', + '^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }], }, testPathIgnorePatterns: ['dist'], setupFiles: ['/jest.setup.js'], diff --git a/src/index.test.ts b/src/index.test.ts index 188b516..ff94e55 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,4 +1,4 @@ -import { main } from 'src' +import { main } from './index' describe(main, () => { it("should return 'Hello, world!'", () => { diff --git a/src/tsconfig.json b/src/tsconfig.json new file mode 100644 index 0000000..58bc76f --- /dev/null +++ b/src/tsconfig.json @@ -0,0 +1,6 @@ +{ + // Workaround VS Code only supporting one default tsconfig.json + // Otherwise *.test.ts files would show errors in VS Code + // See https://stackoverflow.com/questions/57044697/how-to-use-different-tsconfig-file-for-test-files-in-vscode + "extends": "../tsconfig.test.json" +} diff --git a/tsconfig.json b/tsconfig.json index 907bea5..583c39a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,6 @@ "noUnusedLocals": true, "noUnusedParameters": true, "outDir": "dist", - "baseUrl": ".", "sourceMap": true, "strict": true, "target": "es2021", diff --git a/tsconfig.eslint.json b/tsconfig.test.json similarity index 100% rename from tsconfig.eslint.json rename to tsconfig.test.json