-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: errors in mock oauth2 app export from test folder #5386
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
Conversation
| 'use strict'; | ||
|
|
||
| import bodyParser from 'body-parser'; | ||
| import express from 'express'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to have it under src/fixtures/.
|
Maybe we should find a better way to share the mock application, such as its package. Exporting a mock app from the |
@raymondfeng |
The extension packages follow the same convention as core ones for consistency. @bajtos What do you think? |
bad904b to
6df16be
Compare
|
I agree with Raymond that it's a bad practice for packages to export test fixtures. Ideally, we should be excluding the entire What are you @deepakrkris trying to achieve here? Why is If you are trying to share test setup between multiple packages, then please follow the approach we are using for our
In your case, perhaps you should create a new (internal/private?) package providing the mock application, and then add it to dev-dependencies of your projects. Thoughts? |
|
Having wrote the above, maybe it's ok to land the changes in this PR as a short-term fix and then follow up with a refactoring to remove the mock app from exports. |
I like the idea. Let's add a Or simply use |
|
@deepakrkris Let me know if you need some help to set it up. |
|
I am going to implement comments from @bajtos and @raymondfeng , then submit this PR for review again. |
6df16be to
00ae5cc
Compare
0643e9e to
201a806
Compare
|
@bajtos @raymondfeng please review |
| "include": [ | ||
| "src" | ||
| "src", | ||
| "../../fixtures/mock-oauth2-provider/src/mock-oauth2-social-app.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. We should list @loopback/mock-oauth2-provider as devDependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
| @@ -0,0 +1,25 @@ | |||
| Copyright (c) IBM Corp. 2017,2019. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the header - I believe the year should be 2020.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
| { | ||
| "name": "@loopback/mock-oauth2-provider", | ||
| "version": "0.0.1", | ||
| "description": "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
| "dependencies": { | ||
| "passport": "^0.4.1", | ||
| "tslib": "^1.11.2", | ||
| "util-promisifyall": "^1.0.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it used somewhere in the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, will remove
| "devDependencies": { | ||
| "@loopback/build": "^5.3.1", | ||
| "@loopback/eslint-config": "^6.0.6", | ||
| "tslib": "^1.11.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a duplicate of regular dep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
| "jsonwebtoken": "^8.5.1", | ||
| "lodash": "^4.17.15", | ||
| "passport-http": "^0.3.0", | ||
| "passport-oauth2": "^1.5.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe some of the devDependencies should be moved into dependencies if they are used in the code of the mock app (not tests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
| "devDependencies": { | ||
| "@loopback/build": "^5.3.1", | ||
| "@loopback/eslint-config": "^6.0.6", | ||
| "tslib": "^1.11.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be in dependencies only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
| }, | ||
| "dependencies": { | ||
| "passport": "^0.4.1", | ||
| "tslib": "^1.11.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest version should be 2.0.0 now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raymondfeng all loopback packages refer only tslib 1.12.0 as of now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you need to rebase to master. It's all 2.0.0 now.
| "dependencies": { | ||
| "passport": "^0.4.1", | ||
| "tslib": "^1.11.2", | ||
| "tslib": "^1.12.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version should be 2.0.0.
f7c4b7e to
b8862b2
Compare
|
@deepakrkris Please squash the commits into one before landing it. |
b8862b2 to
d47ca2c
Compare
bajtos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, this new version looks much better now!
Please register the new package in the following places, as described in https://github.com/strongloop/loopback-next/blob/master/docs/site/DEVELOPING.md#adding-a-new-package:
- Update MONOREPO.md - insert a new table row to describe the new package, please keep the rows sorted by package name.
- Update CODEOWNERS - add a new entry listing the primary maintainers (owners) of the new package.
d47ca2c to
14ecc13
Compare
0aa798b to
1083430
Compare
bajtos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there! Please move the new row in MONOREPO.md in such place that the table stays sorted.
docs/site/MONOREPO.md
Outdated
| | [service-proxy](https://github.com/strongloop/loopback-next/tree/master/packages/service-proxy) | @loopback/service-proxy | A common set of interfaces for interacting with service oriented backends such as REST APIs, SOAP Web Services, and gRPC microservices | | ||
| | [testlab](https://github.com/strongloop/loopback-next/tree/master/packages/testlab) | @loopback/testlab | A collection of test utilities we use to write LoopBack tests | | ||
| | [tsdocs](https://github.com/strongloop/loopback-next/tree/master/packages/tsdocs) | @loopback/tsdocs | An internal package to generate api docs using Microsoft api-extractor and api-documenter | | ||
| | [fixtures/mock-oauth2-provider](https://github.com/strongloop/loopback-next/tree/master/fixtures/mock-oauth2-provider) | _(private)_ | An internal app to mock the OAuth2 authorization flow login with a social app like facebook, google etc | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<!-- PLEASE KEEP THE TABLE ROWS SORTED ALPHABETICALLY BY PACKAGE NAME-->
dc5196c to
525a594
Compare
fixes: #5380
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm testpasses on your machinepackages/cliwere updatedexamples/*were updated👉 Check out how to submit a PR 👈