Skip to content

feat: add --help integration test #5434

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

Merged
merged 2 commits into from
Aug 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/integration/help.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { runCodeServerCommand } from "../utils/runCodeServerCommand"

// NOTE@jsjoeio
// We have this test to ensure that native modules
// work as expected. If this is called on the wrong
// platform, the test will fail.
Comment on lines +3 to +6
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🙅🏼‍♂️ I know we generally avoid comments like this and prefer putting this info in commits. But I feel like this should be front and center so that future developers don't accidentally delete this test.

I can be convinced otherwise though.

Copy link
Member

@code-asher code-asher Aug 10, 2022

Choose a reason for hiding this comment

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

Yeah this seems like a reasonable comment to me because our motivations for testing --help are not self-apparent.

One way around that would be to change the wording of the test, maybe something like describe("native-modules") and test("it should trigger native modules by running --help") so the reasoning is baked into the code but IMO either way is good (I probably would have gone the comment route as well since you can be more descriptive without making a really long test name).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hadn't thought of going with the test name like that! Good point.

Cool! Glad we're in agreement. Happy to change later if we change our minds as well!

describe("--help", () => {
it("should list code-server usage", async () => {
const expectedOutput = "Usage: code-server [options] [path]"
const { stdout } = await runCodeServerCommand(["--help"])
expect(stdout).toMatch(expectedOutput)
}, 20000)
})