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(types): assert in typescript 3.7 #1198

Merged
merged 2 commits into from
May 20, 2020
Merged

fix(types): assert in typescript 3.7 #1198

merged 2 commits into from
May 20, 2020

Conversation

jkwlui
Copy link
Member

@jkwlui jkwlui commented May 19, 2020

CI started to fail overnight on some assertions in our tests. I believe this has to do with Assertion Functions in TS3.7.

What I basically did in this PR is simply patching the breakrages, as I'm not sure how to proceed otherwise.

Calling on all node/ts experts @googleapis/yoshi-nodejs

@jkwlui jkwlui requested a review from a team as a code owner May 19, 2020 21:42
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 19, 2020
assert(bucket instanceof ServiceObject);
// Using assert.strictEqual instead of assert to prevent
// coercing of types.
assert.strictEqual(bucket instanceof ServiceObject, true);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes the compiler to recognise bucket as type ServiceObject, rather than any, which causes the line below to fail.

I'm starting to think we should probably rewrite our tests in sinon.

@codecov
Copy link

codecov bot commented May 19, 2020

Codecov Report

Merging #1198 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1198   +/-   ##
=======================================
  Coverage   99.18%   99.18%           
=======================================
  Files          12       12           
  Lines       11471    11471           
  Branches      597      530   -67     
=======================================
  Hits        11377    11377           
  Misses         94       94           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 621e6f4...815dff1. Read the comment docs.

@jkwlui jkwlui self-assigned this May 19, 2020
@jkwlui jkwlui mentioned this pull request May 19, 2020
@jkwlui jkwlui merged commit d5aa8b7 into master May 20, 2020
@stephenplusplus stephenplusplus deleted the fix-typescriptassert branch August 10, 2020 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants