The Wayback Machine - https://web.archive.org/web/20220409092808/https://github.com/loopbackio/loopback-next/issues/6391
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

Replace @hapi/shot with light-my-request #6391

Open
bajtos opened this issue Sep 18, 2020 · 10 comments
Open

Replace @hapi/shot with light-my-request #6391

bajtos opened this issue Sep 18, 2020 · 10 comments
Assignees
Labels
good first issue Hacktoberfest refactor Testlab

Comments

@bajtos
Copy link
Member

@bajtos bajtos commented Sep 18, 2020

Rework @loopback/testlab to use light-my-request for stubbing HTTP requests & responses.

Arguments for the change:

@rahil1304
Copy link

@rahil1304 rahil1304 commented Sep 27, 2020

Hey, I'd like to work on this issue. Could you provide some more information?

@bajtos bajtos added the Hacktoberfest label Sep 29, 2020
@bajtos
Copy link
Member Author

@bajtos bajtos commented Sep 29, 2020

Hi @rahil1304, thanks for offering your help! What kind of information are you looking for?

As for this issue in particular:

  • I would start with searching for all places containing the word shot (match case, match whole world in VSCode search) and update them accordingly. Files found by my search:
  • Code and package.json entries referring to @hapi/shot should use light-my-way instead, the docs should be updated similarly.
  • I am not sure if light-my-way ships TypeScript typings. If it does not, then we will need to add @types/light-my-way too.
  • After you modify package.json file, please run npm install to update the installed dependencies too.
@bajtos
Copy link
Member Author

@bajtos bajtos commented Sep 29, 2020

Unfortunately, we don't have tests for shot inside testlab, I think we rely on tests in other packages in the monorepo to verify the functionality. You can run npm test in the monorepo root directory to verify that everything keeps working.

Last but not least, the commit message should annotate the change as breaking, see Making breaking changes in our developer docs.

@bajtos
Copy link
Member Author

@bajtos bajtos commented Sep 29, 2020

Also feel free to ask for help in #loopback-contributors channel, you can join our Slack workspace here.

@rahil1304
Copy link

@rahil1304 rahil1304 commented Oct 10, 2020

Hey @bajtos
I needed some help with the code in the shot.ts file.

import {
  Listener as ShotListener,
  RequestOptions as ShotRequestOptions,
  ResponseObject,
} from 'shot'; 

So these are the particular libraries that are being used from @hapi/shot. Just confirming, I need to find the similar libraries that are being used in light-my-way, and accordingly replace it, right? The rest of the code in shot.ts stays the same, right?

@bajtos bajtos changed the title Replace @hapi/shot with light-my-way Replace @hapi/shot with light-my-request Oct 12, 2020
@bajtos
Copy link
Member Author

@bajtos bajtos commented Oct 12, 2020

Hey @bajtos
I needed some help with the code in the shot.ts file.

import {
  Listener as ShotListener,
  RequestOptions as ShotRequestOptions,
  ResponseObject,
} from 'shot'; 

So these are the particular libraries that are being used from @hapi/shot. Just confirming, I need to find the similar libraries that are being used in light-my-way, and accordingly replace it, right? The rest of the code in shot.ts stays the same, right?

Yes, that's correct.

I just realized that the issue title and description were referring to an incorrect module light-my-way, which does not exist. The correct module name is light-my-request, see https://www.npmjs.com/package/light-my-request.

Sorry for the confusion I created 🙈

AFAICT, light-my-request provides InjectionOptions instead of RequestOptions (see light-my-request/index.d.ts#L31), Response instead of ResponseObject (see light-my-request/index.d.ts#L73. I am not sure what name they use instead of Listener, perhaps DispatchFunc?

@blackpandan
Copy link

@blackpandan blackpandan commented Dec 23, 2020

hello, I would love to work on this

@hacksparrow
Copy link
Contributor

@hacksparrow hacksparrow commented Dec 23, 2020

@blackpandan sure, please go ahead.

@bajtos bajtos assigned blackpandan and unassigned rahil1304 Mar 12, 2021
@ConaGo
Copy link

@ConaGo ConaGo commented Jul 2, 2021

Hi there, if this Issue is still not resolved i would like to give it a shot!

@achrinza
Copy link
Member

@achrinza achrinza commented Jul 3, 2021

Sure thing, @ConaGo! Feel free to ask queries here or on #loopback-contributors on Slack. The maintainers will try to help where possible.

@achrinza achrinza assigned ConaGo and unassigned blackpandan Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Hacktoberfest refactor Testlab
6 participants