Skip to content

Commit

Permalink
test: improve fs mocking with ESM compatibility
Browse files Browse the repository at this point in the history
- Add proper fs module mocking for ESM environment
- Fix test state management between runs
- Add comprehensive error handling tests
- Update ConfigManager to use dynamic fs imports

Co-Authored-By: Michael Latman <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and michaellatman committed Dec 12, 2024
1 parent c2f40b6 commit 9b4e13b
Show file tree
Hide file tree
Showing 9 changed files with 1,756 additions and 129 deletions.
17 changes: 17 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
presets: [
['@babel/preset-env', {
targets: {
node: 'current'
},
modules: 'commonjs' // Force CommonJS modules for testing
}],
'@babel/preset-typescript'
],
env: {
test: {
// Additional test-specific configuration
plugins: []
}
}
};
3 changes: 3 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ const config = {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
// Use ts-jest for TypeScript files
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
// Use babel-jest for mock files
'^.+\\.(m?js|ts)x?$': ['babel-jest', { rootMode: 'upward' }],
},
roots: ['<rootDir>/src', '<rootDir>/test'],
testMatch: [
Expand Down
Loading

0 comments on commit 9b4e13b

Please sign in to comment.