MCPcopy Create free account
hub / github.com/WICG/webpackage / expectToThrowErrorAsync

Function expectToThrowErrorAsync

js/sign/tests/cli-utils_test.js:15–31  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

13// Helper method to test async errors to be thrown, as Jasmine doesn't have
14// support for such matcher.
15async function expectToThrowErrorAsync(f) {
16 if (typeof f !== 'function') {
17 throw new Error(
18 `expectToThrowErrorAsync: Type of parameter "f" is not "function" but "${typeof f}" instead.`
19 );
20 }
21
22 let errorMessage = '';
23 try {
24 await f();
25 } catch (error) {
26 errorMessage = error.message;
27 console.log(errorMessage);
28 }
29
30 expect(errorMessage).not.toBe('');
31}
32
33describe('CLI key parsing', () => {
34 afterEach(() => {

Callers 1

cli-utils_test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected