tests, scripts: cleanup tests and dev environment things#252
Conversation
cabb03d to
7f020e2
Compare
|
@flakey5 -- do you need a review now or is this still WIP? |
|
Still a wip |
74763d5 to
2d28a66
Compare
47f78f7 to
91d7f42
Compare
|
Gonna go ahead and mark this for review now. This unfortunately doesn't resolve the annoyances with running the worker locally though, there's still some things that I need to play around with to see if I can get it working in an ideal way. |
| }, | ||
| }); | ||
|
|
||
| if (env.LOG_ERRORS === true) { |
There was a problem hiding this comment.
Can this be exported to somewhere else?
| files: Record<string, File>; | ||
| } | ||
|
|
||
| async function listDirectory(directoryPath: string): Promise<Directory> { |
There was a problem hiding this comment.
Reading the contents of the dev-bucket folder and loading them into memory for the tests
There was a problem hiding this comment.
OOC, why all these .gitkeep files? Is this like a "test" recration of a folder structure? Instead of this, could we make GHA create all these folders with mkdir before tests? :)
There was a problem hiding this comment.
Is this like a "test" recration of a folder structure
Yeah, this serves two purposes:
- Helps with making local dev easier since a structurally accurate example is provided. This is especially useful for newcomers or for those that don't have R2 access. Ideally this will be reused in the local dev script I mentioned in the pr description but haven't gotten around to making it work yet. This is also why I think we shouldn't generate these files via GHA
- Makes managing the contents of the bucket used during tests easier since it's not just a bunch of binary files
ovflowd
left a comment
There was a problem hiding this comment.
It took me so long to review this and for that, I'm sorry! I left a few comments, but the PR looks good :)
|
cc @flakey5 thanks for bearing with me 🙇 |
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
91d7f42 to
0d252c4
Compare
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
|
@flakey5 OOC are you switching from Wrangler to the Vite Plugin? |
|
Ah sorry, nvm, you just added Vitest. Forgot of that. |
This is an attempt to make the tests and local dev environment a lot nicer to work with.
Some of the main problems with them right now are:
This pr:
dist-prodbucket (calleddev-bucket)tests/e2e/test-data/R2_BUCKETfor e2e testsnpm run dev- starts a locally running version of the worker with a populated R2 bucketPopulated from thedev-bucketdirectoryWhat's TODO:
Some current annoyances:
worker.jsfile. I do have some ideas, but not entirely sure if they're gonna work.Ideally we would be able to use Workers' vitest integration, but it's not really possible since we're doing things like mocking an S3 api in our e2e tests. Vitest patches a lot of modules and globals making things likeWorkaround for this was found, so we can use the Vitest integration nownode:httpunavailable.