Skip to content

feat: implement devServer reuseExisting option - #1116

Merged
KuznetsovRoman merged 1 commit into
masterfrom
TESTPLANE-645.reuse_devserver
Jul 29, 2025
Merged

feat: implement devServer reuseExisting option#1116
KuznetsovRoman merged 1 commit into
masterfrom
TESTPLANE-645.reuse_devserver

Conversation

@KuznetsovRoman

Copy link
Copy Markdown
Member

No description provided.

@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2025

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/testplane@1116

commit: 1dbd6f2

Comment thread src/dev-server/utils.ts
readinessProbe: Exclude<Config["devServer"]["readinessProbe"], Function>,
): Promise<boolean> => {
if (typeof readinessProbe.url !== "string") {
throw new Error("devServer.readinessProbe.url should be set to url");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can add the current passed value here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/dev-server/index.ts Outdated
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'",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When 'reuseExisting' is set...

When 'reuseExisting' option is set
...to set 'devServer.readinessProbe.url' option

}

assert.notCalled(spawnStub);
assert.notCalled(probeServerStub);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to check it here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"probeServerStub" throws if "readinessProbe" is function or if url is not set
So its important that "probeServerStub" is not called

Comment thread test/src/dev-server/index.ts Outdated
});

assert.calledOnceWith(probeServerStub, {
url: "http://localhost:3000",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can move this object into a variable to avoid code duplication

probeRequestInterval: 500,
},
});
assert.calledWith(loggerStub.log, "Reusing existing dev server");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to check that customIsReady stub was called

@KuznetsovRoman KuznetsovRoman Jul 29, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

@KuznetsovRoman
KuznetsovRoman force-pushed the TESTPLANE-645.reuse_devserver branch from 8807a26 to 1dbd6f2 Compare July 29, 2025 12:49
@KuznetsovRoman
KuznetsovRoman merged commit eb92905 into master Jul 29, 2025
5 checks passed
@KuznetsovRoman
KuznetsovRoman deleted the TESTPLANE-645.reuse_devserver branch July 29, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants