Skip to content

feat: use built in node:test runner in all template test implementations - #682

Merged
mcollina merged 38 commits into
fastify:masterfrom
big-kahuna-burger:test-node-builtin
Dec 31, 2023
Merged

mcollina merged 38 commits into
fastify:masterfrom
big-kahuna-burger:test-node-builtin

Conversation

@big-kahuna-burger

@big-kahuna-burger big-kahuna-burger commented Nov 27, 2023 •

Copy link
Copy Markdown
Contributor

Closes #632 #680

For all 4 variants, [cjs,esm] x [js, ts] I've used a locally linked cli to generate a project and have npm i && npm test pass.
Typescript variants have coverage enabled by default, cjs one using c8, esm one using --experimental-test-coverage flag. tsx has been added to devDeps, in order to support ts-esm variant.

Todos

There are two pending issues with this PR afaik:

  • test/templates/app-ts.test.ts is skipped instead of letting it break the complete suite. See more here . Any help would be nice as to what to do with it.

  • script unit:ts-cjs is set to always pass due to ||. This is a chicken-egg problem. Here a template test suite is being run, but that test suite also requires a fastify-cli/helper.js by name. So, I can't really install that as devDependency of self. I'm sure there is some trick to handle this. Any help appreciated again.

  • Skip running template suites on 14/16 <20

  • Node 20 on windows glob error

Checklist

Comment thread .github/workflows/ci.yml Resolved
* ci: only ts

* ci: no c8

* ci: c8 for javascript

* ci: no c8
@big-kahuna-burger

Copy link
Copy Markdown
Contributor Author

imho this can be reviewed now by maintainers.
All workflows are passing on my fork.

@mcollina @Fdawgs
PTAL

@big-kahuna-burger big-kahuna-burger changed the title feat: use built in node:test runner in all template test implementations feat: use built in node:test runner in all template test implementations Nov 28, 2023
@big-kahuna-burger
big-kahuna-burger marked this pull request as draft November 29, 2023 06:30
@big-kahuna-burger

Copy link
Copy Markdown
Contributor Author

Converted to draft. Waiting for #681 to be merged so this can be rebased on top of it.

@big-kahuna-burger
big-kahuna-burger marked this pull request as ready for review December 2, 2023 14:14
@big-kahuna-burger

Copy link
Copy Markdown
Contributor Author

Good for review again @mcollina.
Rebased on top of master, removed del-cli usage in favor of --noEmit flag given to tsc

Comment thread suite-runner.js Resolved

@mcollina mcollina left a comment

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.

lgtm

@mcollina mcollina added the semver-major Issue or PR that should land as semver major label Dec 26, 2023
@mcollina

Copy link
Copy Markdown
Member

Could you remove node v14/v16 from CI? The code that this generates would never run there.

cc @Uzlopak @Fdawgs I'm not sure if we have a parameter for this

@Fdawgs

Fdawgs commented Dec 26, 2023 •

Copy link
Copy Markdown
Member

cc @Uzlopak @Fdawgs I'm not sure if we have a parameter for this

Shared workflow just needs to be updated to use v4, which dropped support for 14 and 16.

This was discussed previously in this PR here: #682 (comment)

@mcollina

Copy link
Copy Markdown
Member

I think we removd the v4 tag for now to avoid massive updates everywhere (by auto merge) that were not necessary.

@Kae7in

Kae7in commented Dec 31, 2023 •

Copy link
Copy Markdown

Any idea when this will get merged? I got a similar error to #680 when starting a project via fastify generate example --lang=ts --esm

@mcollina
mcollina merged commit 196a9fb into fastify:master Dec 31, 2023
@Kae7in

Kae7in commented Dec 31, 2023

Copy link
Copy Markdown

Thank you @mcollina!! That worked. 😄

@big-kahuna-burger
big-kahuna-burger deleted the test-node-builtin branch December 31, 2023 19:45
@Eomm Eomm mentioned this pull request Jan 19, 2024
2 tasks done
@Eomm Eomm mentioned this pull request Jul 20, 2024
2 of 4 tasks
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

semver-major Issue or PR that should land as semver major

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Node.js built-in test runner in templates

4 participants