Skip to content

Commit 3f51b07

Browse files
arbrandesclaude
andcommitted
test: limit ts-jest diagnostics to test files
Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ac68494 commit 3f51b07

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

jest.config.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { createConfig } = require('@openedx/frontend-build');
22

3-
const config = createConfig('jest', {
3+
const mergedConfig = createConfig('jest', {
44
setupFilesAfterEnv: [
55
'<rootDir>/src/setupTest.js',
66
],
@@ -22,7 +22,7 @@ const config = createConfig('jest', {
2222
testEnvironment: 'jsdom',
2323
});
2424

25-
// delete config.testURL;
25+
// delete mergedConfig.testURL;
2626

2727
// NOTE: jest-console-group-reporter@1.1.1 uses @jest/reporters@^30 internally
2828
// (via its peer dep resolution) but this project runs Jest 29, whose globalConfig
@@ -31,9 +31,20 @@ const config = createConfig('jest', {
3131
// "Cannot read properties of undefined (reading 'isSet')", causing a non-zero
3232
// exit code even when all tests pass. Disabled until the package is updated for
3333
// Jest 29/30 compatibility.
34-
// config.reporters = [...(config.reporters || []), ["jest-console-group-reporter", {
34+
// mergedConfig.reporters = [...(mergedConfig.reporters || []), ["jest-console-group-reporter", {
3535
// afterEachTest: { enable: true, filePaths: false, reportType: "details" },
3636
// afterAllTests: { reportType: "summary", enable: true, filePaths: true },
3737
// }]];
3838

39-
module.exports = config;
39+
// Limit ts-jest diagnostics to test files so type errors in transformed
40+
// dependencies (included via transformIgnorePatterns) don't fail the run.
41+
mergedConfig.transform['^.+\\.[tj]sx?$'] = [
42+
'ts-jest',
43+
{
44+
diagnostics: {
45+
exclude: ['!**/*.test.*'],
46+
},
47+
},
48+
];
49+
50+
module.exports = mergedConfig;

0 commit comments

Comments
 (0)