Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@paulo-ferraz-oliveira
Copy link
Collaborator

@paulo-ferraz-oliveira paulo-ferraz-oliveira commented Apr 26, 2025

Description

This change stemmed from a proposal in #327.

The goal of the change is to approach a more modern (and readable?) way of writing tests and looking at execution output.

I didn't bother to review the existing tests, but only to propose a new format for writing them. If needed I can revise them in a different pull request, which means "This pull request is probably best seen with Hide whitespace enabled".

Ref.: https://nodejs.org/api/test.html#describe-and-it-aliases.

Further considerations

  • changes regarding Gleam aren't "this pull request" -specific, but they make "this pull request"'s CI fail, which is why I added them here. If you want I can do it in a separate pull request, though.

  • changes regarding Ubuntu-24.04 aren't "this pull request" -specific, but they make "this pull request"'s CI fail (or get warned on), which is why I added them here. If you want I can do it in a separate pull request, though.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

@iStefo, feel free to give this a look-see and propose changes.

"markdownlint": "markdownlint *.md ./github/**/*.md",
"shellcheck": "shellcheck .github/workflows/*.sh",
"test": "node test/setup-beam.test.js",
"test": "node --test --test-reporter=spec",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without --test-reporter=spec ::debug:: gets output as # ::debug:: which means GitHub Actions can't understand debug is off.

Copy link
Member

@starbelly starbelly left a comment

Choose a reason for hiding this comment

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

LGTM ❤️

@starbelly starbelly merged commit 8e3c26c into main Apr 26, 2025
52 checks passed
@starbelly starbelly deleted the fix/for-suites-and-tests branch April 26, 2025 22:54
Copy link

@iStefo iStefo left a comment

Choose a reason for hiding this comment

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

I appreciate you adopting the node test runner!

I think it greatly helps structuring tests, having a standardized way of configuring each test's preconditions (see my comment), identifying individual test failures and also allows executing specific parts of the suits in isolation (which is faster and avoids cluttering the the console with output from other tests).

So big 👍 from my side

'https://repo.hex.pm, https://cdn.jsdelivr.net/hex',
{ multiline: true },
)
const previousRunnerArch = process.env.RUNNER_ARCH
Copy link

@iStefo iStefo Apr 27, 2025

Choose a reason for hiding this comment

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

Configuring or restoring environment and mocks should general happen in before/after or beforeEach/afterEach blocks. This helps readers understand that setup/teardown code is being run (in contrast to code that dynamically generates test cases) and ensure that the modifications actually happen at the correct time (afaik the test runner doesn't necessarily execute the tests in the moment they are defined using it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good to know, thanks. 👍 For now, I just wanted to have a base building block.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

This change was released in v1.19.0, also tagged v1.19 and v1 (moved).

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.

3 participants