Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Error printout for protocol-response tests #657

Merged
merged 3 commits into from
Dec 13, 2022

Conversation

haydenbaker
Copy link
Contributor

@haydenbaker haydenbaker commented Dec 13, 2022

Issue #, if available:

Description of changes:
Fixes an issue brought in through #645

Testing

  • built smithy-typescript and published to local maven
  • ran client-generation in JS SDK, verified no build errors
  • ran protocol-test generation and ran tests, verified no build errors
  • verified code-gen:
  let r: any;
  try {
    r = await client.send(command);
  } catch (err) {
    fail("Expected a valid response to be returned, got " + err);
    return;
  }
  • verified test output for a forced-to-fail test:
  ● Ec2QueryDateTimeWithPositiveOffset:Response

    Expected a valid response to be returned, got TypeError: Invalid RFC-3339 date-time value

(NOTE: I intentionally made this test fail)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

haydenbaker and others added 3 commits November 22, 2022 07:53
Jest versions >= 27 replace jest-jasmine2 with jest-circus, which does
not have an implementation for the `fail()` method, but still has
the method stub defined in the Jest type-defs. This change implements
the `fail()` method in protocol test suites, and adjusts the thrown
message to actually state the error, instead of just `err`.
When writing strings with newlines and interpolation, code can get mangled
and won't compile. This change makes the error printout a single-line and not
interpolated.
@haydenbaker haydenbaker requested a review from srchase December 13, 2022 14:21
@haydenbaker haydenbaker requested a review from a team as a code owner December 13, 2022 14:21
@haydenbaker haydenbaker changed the title Fix missing reference Fix Error printout for protocol-response tests Dec 13, 2022
@srchase srchase merged commit 2132bdd into smithy-lang:main Dec 13, 2022
milesziemer pushed a commit to milesziemer/smithy-typescript that referenced this pull request Dec 14, 2022
* Fix broken reference to `fail()` after jest-upgrade

Jest versions >= 27 replace jest-jasmine2 with jest-circus, which does
not have an implementation for the `fail()` method, but still has
the method stub defined in the Jest type-defs. This change implements
the `fail()` method in protocol test suites, and adjusts the thrown
message to actually state the error, instead of just `err`.

* Remove interpolation of error in response tests

When writing strings with newlines and interpolation, code can get mangled
and won't compile. This change makes the error printout a single-line and not
interpolated.
srchase pushed a commit to srchase/smithy-typescript that referenced this pull request Mar 17, 2023
* Fix broken reference to `fail()` after jest-upgrade

Jest versions >= 27 replace jest-jasmine2 with jest-circus, which does
not have an implementation for the `fail()` method, but still has
the method stub defined in the Jest type-defs. This change implements
the `fail()` method in protocol test suites, and adjusts the thrown
message to actually state the error, instead of just `err`.

* Remove interpolation of error in response tests

When writing strings with newlines and interpolation, code can get mangled
and won't compile. This change makes the error printout a single-line and not
interpolated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants