feat: implement devServer reuseExisting option - #1116
Conversation
commit: |
| readinessProbe: Exclude<Config["devServer"]["readinessProbe"], Function>, | ||
| ): Promise<boolean> => { | ||
| if (typeof readinessProbe.url !== "string") { | ||
| throw new Error("devServer.readinessProbe.url should be set to url"); |
There was a problem hiding this comment.
we can add the current passed value here
There was a problem hiding this comment.
In this function we dont need to
This exception can't be shown to user: this function is only called when "readinessProbe.url" is string and it is checked in function, which is calling this
| if (devServerConfig.reuseExisting) { | ||
| if (typeof devServerConfig.readinessProbe === "function" || !devServerConfig.readinessProbe.url) { | ||
| throw new Error( | ||
| "When 'reuseExisting' is set to 'true' in 'devServer' config, it is required to set 'devServer.readinessProbe.url'", |
There was a problem hiding this comment.
When 'reuseExisting' is set...
When 'reuseExisting' option is set
...to set 'devServer.readinessProbe.url' option
| } | ||
|
|
||
| assert.notCalled(spawnStub); | ||
| assert.notCalled(probeServerStub); |
There was a problem hiding this comment.
why do we need to check it here?
There was a problem hiding this comment.
"probeServerStub" throws if "readinessProbe" is function or if url is not set
So its important that "probeServerStub" is not called
| }); | ||
|
|
||
| assert.calledOnceWith(probeServerStub, { | ||
| url: "http://localhost:3000", |
There was a problem hiding this comment.
you can move this object into a variable to avoid code duplication
| probeRequestInterval: 500, | ||
| }, | ||
| }); | ||
| assert.calledWith(loggerStub.log, "Reusing existing dev server"); |
There was a problem hiding this comment.
it would be better to check that customIsReady stub was called
There was a problem hiding this comment.
It is a part of another module and should not be tested in "test/src/dev-server/index.ts"
I will write corresponding test in "dev-server/utils.ts"
8807a26 to
1dbd6f2
Compare
No description provided.