-
Notifications
You must be signed in to change notification settings - Fork 104
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: 修正單元測試程式,修正覆蓋率問題與通過 mongoose v7 版本 #58
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #58 +/- ##
===========================================
- Coverage 100.00% 98.84% -1.16%
===========================================
Files 1 6 +5
Lines 14 173 +159
Branches 4 36 +32
===========================================
+ Hits 14 171 +157
- Misses 0 2 +2
☔ View full report in Codecov by Sentry. |
#54 发布的是一个 major 版本,确实它的单测有问题,需要修复,我们应该修复单测,而不是将 mongoose 的版本降级回去。 |
1 similar comment
This comment was marked as duplicate.
This comment was marked as duplicate.
1. 移除無用的參數設定 useNewUrlParser https://mongoosejs.com/docs/6.x/docs/migrating_to_6.html#no-more-deprecation-warning-options 2. 停止 custom-promise 的支援 https://mongoosejs.com/docs/migrating_to_7.html#removed-support-for-custom-promise-libraries
@fengmk2 已修正,在麻煩確認一下,謝謝 |
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.
+1
Checklist
npm test
passesDescription of change
前景提要
我觀察到
egg-mongoose
升級至 v4 版本 PR #54後,測試覆蓋率雖然高達 100%,但只測試到lib/filterURLPassword.js
,其他 test case 被跳過了,以下為連結與截圖:https://app.codecov.io/gh/eggjs/egg-mongoose/pull/57/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eggjs
修正方向
function*
與yield
改為async
與await
語法,修改後可正常測試,以下為截圖。mongoose
降級版本為v5
版本,因為目前 test case 並沒有升級至v7
版本,像是:Model.remove
被移除了而無法通過測試,請參考文件。useNewUrlParser
已被棄用而無法通過測試,請參考文件。討論
建議將
mongosse
加入peerDependencies
與devDependencies
,讓用戶自行選擇版本,因為egg-mongoose
只負責掛載。