-
-
Notifications
You must be signed in to change notification settings - Fork 39
build: standardize test scripts #357
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
base: main
Are you sure you want to change the base?
Conversation
|
The rewrite/.github/workflows/ci.yml Lines 74 to 97 in 1280e79
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this concerns the common convention across repositories that include a test:types script.
In the CSS repository, the tsc -p tests/types/tsconfig.json script appears to run after npm run build
(ref: https://github.com/eslint/css/blob/321d4705e396f0838e7960de45c8dd5947e2ecf1/package.json#L62).
However, aside from the CSS repository, I don't see other repositories running npm run build before testing types.
I don't have a strong preference, but it would be nice to standardize this across repositories.
|
In "pretest": "npm run build",
"test": "npm run test:types && npm run test:cjs && npm run test:esm",
"test:cjs": "mocha --color --reporter progress --timeout 30000 \"tests/**/*.test.cjs\"",
"test:esm": "c8 mocha --color --reporter progress --timeout 30000 \"tests/**/*.test.js\"",
"test:types": "tsd --typings dist/espree.d.ts"
If the intent is simplifying entering commands during development, perhaps this could be an option? |
I think it's a good option, since CSS and JSON also use the
One more thing to discuss: unlike Maybe it would make sense to group only the type and unit tests into a single To clarify, my suggestion is: "pretest": "npm run build",
"test": "npm run test:types && npm run test:unit",
"test:coverage": "c8 npm test",
"test:jsr": "npx -y jsr@latest publish --dry-run",
"test:types": "tsc -p tests/types/tsconfig.json"
"test:unit": "mocha \"tests/**/*.test.js\" --timeout 30000", |
|
I've hit this in our other repos too and it’s definitely a friction point—it's easy to waste time debugging a 'fail' that’s actually just a stale build. I get the concern about CI redundancy, but maybe we could add the |
Sounds good to me. @fasttime, what do you think about moving in this direction? |
I think it's still good to run unit tests separately from type tests in GitHub Actions. Currently, this is done by running the top-level rewrite/.github/workflows/ci.yml Lines 51 to 53 in 11e1df2
Line 7 in 11e1df2
If the |
Sounds good 👍. We can add a top-level "test:unit": "npm run test:unit --workspaces --if-present" |
That should work. Noting that |
Prerequisites checklist
What is the purpose of this pull request?
Standardizes the test and build orchestration across all packages in the monorepo.
What changes did you make? (Give an overview)
test:unitscript across all packages for granular testingtestscripts to run both types and unit tests where applicabletest:unitin the build matrixpretestscripts for consistencyRelated Issues
Is there anything you'd like reviewers to focus on?