This repository was archived by the owner on Aug 1, 2024. It is now read-only.
'(error?: string | RegExp | Constructable | Error | undefined): void' is deprecated.ts(6385) index.d.ts(1140, 12): The declaration was marked as deprecated here. (method) jest.Matchers<void, () => void>.toThrowError(error?: string | RegExp | jest.Constructable | Error | undefined): void If you want to test that a specific error is thrown inside a function. @deprecated — in favor of toThrow #1425
Replies: 1 comment
-
Also NODEJS14 is deprecated update it to latest version or at least 16 in Typescript workshop please |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://cdkworkshop.com/20-typescript/70-advanced-topics/100-construct-testing/2000-validation-tests.html
Test code throws error coz of deprecated string
test('read capacity can be configured', () => {
const stack = new cdk.Stack();
expect(() => {
new HitCounter(stack, 'MyTestConstruct', {
downstream: new lambda.Function(stack, 'TestFunction', {
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'hello.handler',
code: lambda.Code.fromAsset('lambda')
}),
readCapacity: 3
});
}).toThrowError(/readCapacity must be greater than 5 and less than 20/);
});
instead of above code we can use below code
You can replace it with toThrow to achieve the same effect. Here's the updated test:
Someone fork this change i am too lazy to do that and admin dont allow PR's pfft
Beta Was this translation helpful? Give feedback.
All reactions