75333b33101a90206ff06b9aec29cfd61a14532c
- Import additional exception classes from `src/interfaces/Exceptions` - Modify `Inject` function to: - Accept `init` parameter as a function or `true` for instantiation - Throw specific errors: `DependencyResolutionError`, `InjectorError`, `NoInstantiationMethodError` - Ensure necessary dependencies are handled properly - Define property with `Object.defineProperty` for performance - Add `hasConstructor` helper function to check if an object has a constructor
TSinjex
Configuration
Jest
Example jest setup
module.exports = {
setupFilesAfterEnv: ['./scripts/jest.setup.js'],
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/__tests__/**/*.test.ts', '**/?(*.)+(test).ts'],
moduleDirectories: ['node_modules', 'src'],
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/src/$1', // Map src to the source folder
'^ts-injex$': '<rootDir>/node_modules/ts-injex/src', // Map ts-injex to the source folder
},
transformIgnorePatterns: [
'node_modules/(?!ts-injex)' // **Dont** ignore ts-injex on preset `ts-jest`
],
};
Languages
TypeScript
85.9%
JavaScript
14.1%