-
Notifications
You must be signed in to change notification settings - Fork 127
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
Added verdaccio test #268
Added verdaccio test #268
Conversation
Thanks for opening this PR! We would appreciate it if you could provide us with more info about your PR 🙏 |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## blog/crucial-tests #268 +/- ##
=====================================================
Coverage ? 90.92%
=====================================================
Files ? 16
Lines ? 595
Branches ? 43
=====================================================
Hits ? 541
Misses ? 53
Partials ? 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I feel like it needs some more content... 😕 |
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.
@rluvaton The code example is awesome, let's spend some short time doing justice with it and wrapping it with great texts and examples?
docs/blog/crucial-tests/index.md
Outdated
@@ -394,6 +392,50 @@ beforeAll(() => { | |||
}); | |||
``` | |||
|
|||
## 📦 Test the package as a consumer | |||
|
|||
a lot of times we don't test our packages as how our consumers will use them, |
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.
Not the same format like other bullets, e.g., "What & why:" section
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.
thanks, fixed
docs/blog/crucial-tests/index.md
Outdated
## 📦 Test the package as a consumer | ||
|
||
a lot of times we don't test our packages as how our consumers will use them, | ||
this is a simplified example of how we could do that |
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.
Missing here a simple explanation of a problem, e.g. '100% of your library's tests pass, the tests are great, they cover all the scenarios, but shockingly they fail in production, how come?? while the tests work against the local developer files, your user will work against the artifacts that were packed and zipped. If a single file is excluded due to build configuration or becauase of .npmignore, the code will fail...'
I can write myself, but I find it to be a great exercise for Raz the super-technical engineer to explain things in a CTO-level language:)
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.
thanks, updated
this is a simplified example of how we could do that | ||
|
||
```js | ||
// global-setup.js |
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 wouldn't couple our article to Jest, the before hook is more universal
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.
global setup is not coupled to jest, I used global setup to show that this should be run once in all tests - hence global (also the before run in each file)
docs/blog/crucial-tests/index.md
Outdated
await setupVerdaccio(); | ||
|
||
// 2. Building our package | ||
await execa('npm', ['run', 'build'], { |
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.
execa is unneccessary concept that the reader should reason about
exec('command') is almost as easy and standard, or at least put a comment explaining that execa runs chid-process commands
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.
changed to exec
|
||
a lot of times we don't test our packages as how our consumers will use them, | ||
this is a simplified example of how we could do that | ||
|
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.
Before the working example, I would consider showing the failing example briefly:
// package.json, only the files entry with index.js only
// index.js file which require 'lib-internal.js file
// local test that require lib-internal/function, explain with comments that it will work on developer machine 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.
created a failing example while guiding the reader to the trap (the mistake that happen)
@rluvaton I merged first before reviewing as I prefer to review the entire article, all together, before merging to main For now it seems 98% great, leme revise one time more before publishing |
* First draft * First draft * Added verdaccio test (#268) * Update index.md * fix comment * added the verdaccio test * Update index.md * used import/export and update content * update content * update content * Genric message * Genric message * Genric message --------- Co-authored-by: Yoni Goldberg <goldbergyoni@Yonis-MacBook-Pro-2.local> Co-authored-by: Raz Luvaton <16746759+rluvaton@users.noreply.github.com>
* First draft * First draft * Added verdaccio test (#268) * Update index.md * fix comment * added the verdaccio test * Update index.md * used import/export and update content * update content * update content * Genric message * Genric message * Genric message * Genric message * Genric message --------- Co-authored-by: Yoni Goldberg <goldbergyoni@Yonis-MacBook-Pro-2.local> Co-authored-by: Raz Luvaton <16746759+rluvaton@users.noreply.github.com>
* First draft * First draft * Added verdaccio test (#268) * Update index.md * fix comment * added the verdaccio test * Update index.md * used import/export and update content * update content * update content * Genric message * Genric message * Genric message * Genric message * Genric message * Correct date --------- Co-authored-by: Yoni Goldberg <goldbergyoni@Yonis-MacBook-Pro-2.local> Co-authored-by: Raz Luvaton <16746759+rluvaton@users.noreply.github.com>
* First draft * First draft * Added verdaccio test (#268) * Update index.md * fix comment * added the verdaccio test * Update index.md * used import/export and update content * update content * update content * Genric message * Genric message * Genric message * Genric message * Genric message * Correct date * Correct date --------- Co-authored-by: Yoni Goldberg <goldbergyoni@Yonis-MacBook-Pro-2.local> Co-authored-by: Raz Luvaton <16746759+rluvaton@users.noreply.github.com>
* First draft * First draft * Added verdaccio test (#268) * Update index.md * fix comment * added the verdaccio test * Update index.md * used import/export and update content * update content * update content * Genric message * Genric message * Genric message * Genric message * Genric message * Correct date * Correct date * Genric message2 * Genric message2 --------- Co-authored-by: Yoni Goldberg <goldbergyoni@Yonis-MacBook-Pro-2.local> Co-authored-by: Raz Luvaton <16746759+rluvaton@users.noreply.github.com>
* First draft * First draft * Added verdaccio test (#268) * Update index.md * fix comment * added the verdaccio test * Update index.md * used import/export and update content * update content * update content * Genric message * Genric message * Genric message * Genric message * Genric message * Correct date * Correct date * Genric message2 * Genric message2 * Genric message2 --------- Co-authored-by: Yoni Goldberg <goldbergyoni@Yonis-MacBook-Pro-2.local> Co-authored-by: Raz Luvaton <16746759+rluvaton@users.noreply.github.com>
No description provided.