-
-
Notifications
You must be signed in to change notification settings - Fork 24
Jest testing #309
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
Jest testing #309
Conversation
|
Looks like I made a typo in one of the eask commands. Good to see npm runs on all OS's and produces a similar error in each case. |
|
Looking good so far! 🚀 😉 Can
I prefer keeping everything under the
👍 Yeah, my test was pretty simple and just focused on what works and what doesn’t.
CJS is fine since ESM is not supported in yao-pkg... yet? See #291. Edit: Could you add some documentation? It would be helpful to have details on things like this! 😁 |
|
Have cut down the CI jobs for now. I put the ones that I plan to merge into Jest Tests, but haven't yet, in the deprecated folder. |
That's a really useful idea! I've added the
Sweet, I'll move them there.
Absolutely. I'll add comprehensive doco perhaps more at the end of the PR when things stabilize, just to avoid revising it a lot. |
ec0a8a1 to
6f8eeea
Compare
14b893c to
5dd3782
Compare
32099e6 to
597db81
Compare
63581bb to
949a6fc
Compare
949a6fc to
7f75288
Compare
|
rebased to remove jest workflow and recover the previous workflows |
03926c5 to
9d0d3f7
Compare
9d0d3f7 to
e31f0f5
Compare
|
The PR looks ready? Is there something we missed? 😋 |
.github/workflows/test_buttercup.yml
Outdated
| - name: Testing... | ||
| run: | | ||
| make test-buttercup | ||
| npm run test-unsafe test/jest/buttercup.test.js |
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.
The name should be test-buttercup.test.js? 🤔
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.
good spot! renamed it too
| - name: Testing... | ||
| run: | | ||
| make command-outdated-upgrade | ||
| npm run test-unsafe test/jest/outdated.test.js |
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.
The name should be outdated-upgrade.test.js?
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.
correct, renamed
|
🥳 Thank you very much for this! We finally have the local testing! |
Closes #308
Test scripts and fixtures are all in
test/jest.I've followed the pattern
workflows/<x>.ymlbecomestest/jest/<x>.test.jsand any project files are intest/jest/<x>/.Most of the project files are either the local files from the original test directories, or renamed copies of
mini.pkg.1fromtest/fixtures. This is to make sure tests are properly isolated.npm run test.npm run test ./test/jest/analyze.test.jsnpm run test-debug ./test/jest/analyze.test.jspackage.json(I use relative paths in the tests)I've added a doco file under Contributing/Testing. It should probably replace the Testing section in the Contributing/Developing Eask page.
Test naming
I've used something like this when the tests are simply "does it work"
pretty easy to quickly re-run the test in a shell to work out what's broken.
For example
local.test.jsBut proper behavior tests probably need a different style
For example
link.test.jsMatrix
These are the existing tests and the versions they run on, per the workflows.
Emacs versions: 26.3, 27.2, 28.2, 29.4, 30.1, snap
OS: linux (ubuntu), win, mac
Notes
can use ESM too if you'd like
ALLOW_UNSAFEallows tests that modify global or config files.Use
testUnsafe()instead oftest()orit()for any tests that use --config or --globalexpect(cmd).rejects.toThrow()or else it will give a false positive!spawn /bin/sh ENOENTmeans that thecwdpath doesn't exist, check it is correct relative to project rootnpm i --no-save @types/jestto improve local development.EASK_COMMAND=$PWD/bin/easkto use the local version of eask, e.g.env EASK_COMMAND=$PWD/bin/eask npm run testTODOs
install-depsshould be in abeforeAllrather than a testtest/jssee
analyze.test.jseaskand./bin/easkin commands, likely with a command helperrunEask("install-deps")see
TestContextin./helpers.jsand example inexec.test.js