-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Make boolean config value parsing backward-compatible (#10560
- Loading branch information
Showing
3 changed files
with
75 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Container } from 'typedi'; | ||
import { Config, Env } from '../src/decorators'; | ||
|
||
describe('decorators', () => { | ||
beforeEach(() => { | ||
Container.reset(); | ||
}); | ||
|
||
it('should throw when explicit typing is missing', () => { | ||
expect(() => { | ||
@Config | ||
class InvalidConfig { | ||
@Env('STRING_VALUE') | ||
value = 'string'; | ||
} | ||
Container.get(InvalidConfig); | ||
}).toThrowError( | ||
'Invalid decorator metadata on key "value" on InvalidConfig\n Please use explicit typing on all config fields', | ||
); | ||
}); | ||
}); |