-
Notifications
You must be signed in to change notification settings - Fork 8
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
Track the requirements #9
Comments
Totally agree with you. I have a couple of "standard" npm scripts I use across my projects that improve the overall DX: "ci:test": "npm run coverage && npm run test:types",
"coverage": "npm run unit -- --coverage-report=lcovonly",
"lint": "standard",
"lint:fix": "standard --fix",
"test": "npm run lint && npm run unit && npm run test:types",
"test:types": "tsd"
"unit": "tap -J \"test/**/*.test.js\"",
"unit:errors": "npm run unit -- -R terse",
"unit:report": "npm run unit -- --coverage-report=html",
"unit:verbose": "npm run unit -- -Rspec" |
Just to add, this was partially discussed in the fastify/plugins Discussions last year. Throwing all of the tests into the |
@Fdawgs something like this then ? "coverage": "npm run unit -- --coverage-report=lcovonly", // useful to generate coverage report consumed by code coverage services
"lint": "standard",
"lint:fix": "standard --fix",
"test": "npm run coverage && npm run test:types", // target: ci run
"test:dev": "npm run lint && npm run unit && npm run test:types", // target: pre-commit run on user workflow (e.g.: my use case)
"test:types": "tsd"
"unit": "tap -J \"test/**/*.test.js\"", // just run the test suite
"unit:errors": "npm run unit -- -R terse", // run the test suite and display only errors (thanks to James Sumners that's now one of my best friends 😛)
"unit:report": "npm run unit -- --coverage-report=html", // useful to track the code coverage
"unit:verbose": "npm run unit -- -Rspec" // useful to track down tests failures and maintain a good DX (test descriptions, operations, plans ... etc) |
|
This is how I use it on my workflow, I split each operations on dedicated scripts and in addition I have a CI dedicated script. |
update https://github.com/darkgl0w/fastify-swagger/blob/exp-alt/.github/workflows/ci.yml |
@fastify/plugins, if we can agree on what name the CI test script should have, as discussed in comments above, then this can get moving and can be applied to more plugin repos. |
In order of preference I would go for PS: It would be awesome if we could agree on removing (at least) node 10 from the test matrix too. |
|
I think there are two topics:
The first one requires:
I think we should not use The latter is for us: it helps us to remember simple commands:
The other stuff adds too much noise into the |
@Eomm I'd say this is done? We have the
for dir in */; do
if [ -f "$dir/package.json" ]; then
has_test=$(grep -q '"test":' "$dir/package.json" && echo "true" || echo "false")
has_lint=$(grep -q '"lint":' "$dir/package.json" && echo "true" || echo "false")
if [ "$has_test" == "false" ] && [ "$has_lint" == "true" ]; then
echo "$dir has a test script but no lint script"
fi
if [ "$has_test" == "true" ] && [ "$has_lint" == "false" ]; then
echo "$dir has a lint script but no test script"
fi
fi
done These aren't plugins though, so can be ignored. |
Prerequisites
🚀 Feature Proposal
After #8 we should document in a more clear way the requirements for the project to adopt the reusable workflow.
For example:
npm test
should not run the linterlint
script should run all the lintersMotivation
I think in future the requirements will grow up, so we should start listing it before it will be too late to understand how to set up a repository
Example
No response
The text was updated successfully, but these errors were encountered: