Skip to content

Conversation

@jannyHou
Copy link
Contributor

Implements #5298 and #5300

Based on the spike in #5004

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

it mounted on with command `npm test`.

We want the LoopBack 3 tests to use the LoopBack 4 server rather than the
LoopBack 3 application. The following guide shows how to run
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to briefly explain why here? e.g circular dependency or something else. Feel free to ignore :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@agnes512 Taking the CoffeeShopApplication as an example, when you run the app, it sets up a LB4 rest server and mounts the LB3 app as its component. Therefore all endpoints from the LB3 app are exposed on that server.

And that's why to test those LB3 endpoints, we want to guarantee ^ as well 🙂.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can run tests in an LoopBack 3 application from the LoopBack 4 application
it mounted on with command npm test.

The statement is confusing. It's not clear in which directory the test would be run.

Copy link
Contributor

Choose a reason for hiding this comment

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

We want the LoopBack 3 tests to use the LoopBack 4 server rather than the
LoopBack 3 application.

Does it use the LoopBack 3 application otherwise?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not clear in which directory the test would be run.

@hacksparrow The tests are kept in the LB3 application.

  • lb3-app
    • tests // we want to run the tests here
  • src
    • lb4app
    • __tests__

Copy link
Contributor Author

@jannyHou jannyHou May 15, 2020

Choose a reason for hiding this comment

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

@hacksparrow I looked at the doc again, and I believe

You can run tests in an LoopBack 3 application from the LoopBack 4 application
it mounted on with command npm test.

says clearly which directory the test would be run: "tests in an LoopBack 3 application". Or did you mean anything else?

Copy link
Contributor

@agnes512 agnes512 left a comment

Choose a reason for hiding this comment

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

Thanks for providing such clear steps! :D


In your test file:

1. When launch the Express server
Copy link
Contributor

Choose a reason for hiding this comment

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

As someone who's interested in running my LB3 app tests, I'd be confused why I need Express server.

Copy link
Contributor Author

@jannyHou jannyHou May 15, 2020

Choose a reason for hiding this comment

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

@hacksparrow see my comment in #5403 (comment)
I think you are confused because you are new to this example. Please note the doc is added in the README.md file of the example repo.
This example demos two scenarios: "mounts lb3 app to lb4" and "mounts lb4 including lb3 to express server"

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.

6 participants