Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
test setup #74 #75
test setup #74 #75
Changes from all commits
4f8caad
8572c31
5d8e8ad
a6f6d52
0e310e9
1a2b21c
eaff0ec
76d16cf
430711c
e4044ed
45b13a3
c7afdc5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Dotenv just imported whatever I had in my
.env
file, as without those, it would fall over. This also meant that I don't have to worry about var being added or removed. It becomes extremely(!!!!) important to make sure you aren't "leaking" anything out to the real world, however. In Scrivener, I am managing this by using MSW with a catchall:And then firestore has this really nice feature of the
FIRESTORE_EMULATOR_HOST
env var, which will make it point to the emulator instead of real firebase.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 thought it will run firestore emulator then jest. but even run-p didn't work even thu it worked with
start
command.this will surely be a lot cleaner. I will do the changes.
@JacobMGEvans is it okay to do so?
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 see now. that cleared alot of things for me. 🙏🏼 thanks 🙂
using the emulator is way better than using MSW to fake the requests. because
firebase url
are pretty damn big.I dont think that the
FIRESTORE_EMULATOR_HOST
var works here in this line. when i added it, it was for the test env to pick up on it but the way you wrote the script and configured the env var bypassed its use case.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.
@AhmedEldessouki the way you set it here doesn't set an env var. You will have to use something like cross-env and set it first - see Guild Scrivener for how I setup a generic "execute firestore" command that everything else hooks off of for a solid example.
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 for pointing that out 🙂 I will look for it 😁😁
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.
Cant work around this. int the Guild Scrivener you are using Node env. do you think it's possible for
@firebase/testing
to work in Jsdom env?Error: FIRESTORE (8.2.4) INTERNAL ASSERTION FAILED: Unexpected state
I ran into this problem before when i was testing firestore-rules (Node env). after i worked around it, jsdom tests was being unexpected and then i removed firestore-rules test
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.
When we use the emulators, we don't have to mock anything because we are just interfacing with the emulator instead of the real thing - yes you still have to "seed" the data.
This can be done by just importing from the
devData
dir for now, as the website is really read-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.
totally agree. i tried it before mocking but when it failed i when with mocking. i will do remove the mocks.
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.
Clean up later