Summary: | Add test to detect when yarn.lock is not updated | ||
---|---|---|---|
Product: | Koha | Reporter: | Mason James <mtj> |
Component: | Test Suite | Assignee: | Mason James <mtj> |
Status: | Pushed to main --- | QA Contact: | Martin Renvoize (ashimema) <martin.renvoize> |
Severity: | normal | ||
Priority: | P5 - low | CC: | jonathan.druart, martin.renvoize |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: |
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37302 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37303 |
||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 37490: add a test to detect when yarn.lock is not updated
Bug 37490: add a test to detect when yarn.lock is not updated Bug 37490: Add a test to detect when yarn.lock is not updated Bug 37490: Add a test to detect when yarn.lock is not updated |
Description
Mason James
2024-07-26 10:40:45 UTC
Created attachment 169693 [details] [review] Bug 37490: add a test to detect when yarn.lock is not updated to test... 1/ set koha repo to state where yarn.lock is not updated $ git reset --hard 67db70d4 2/ run test, observe FAIL $ prove ./xt/verify-yarnlock.t ./xt/verify-yarnlock.t .. error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`. ./xt/verify-yarnlock.t .. 1/1 # Failed test 'verify yarn.lock file is updated correctly' ... Result: FAIL 3/ set koha repo to state where yarn.lock is updated $ yarn install 4/ note yarn.lock is now updated $ git status ... modified: yarn.lock 5/ run test, observe SUCCESS $ prove -v ./xt/verify-yarnlock.t ./xt/verify-yarnlock.t .. ok 1 - verify yarn.lock file is updated correctly All tests successful. Files=1, Tests=1, 1 wallclock secs ( 0.02 usr 0.01 sys + 1.16 cusr 0.27 csys = 1.46 CPU) Result: PASS Created attachment 169698 [details] [review] Bug 37490: add a test to detect when yarn.lock is not updated to test... 1/ set koha repo to state where yarn.lock is not updated $ git reset --hard 67db70d4 2/ run test, observe FAIL $ prove ./xt/verify-yarnlock.t ./xt/verify-yarnlock.t .. error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`. ./xt/verify-yarnlock.t .. 1/1 # Failed test 'verify yarn.lock file is updated correctly' ... Result: FAIL 3/ set koha repo to state where yarn.lock is updated $ yarn install 4/ note yarn.lock is now updated $ git status ... modified: yarn.lock 5/ run test, observe SUCCESS $ prove -v ./xt/verify-yarnlock.t ./xt/verify-yarnlock.t .. ok 1 - verify yarn.lock file is updated correctly All tests successful. Files=1, Tests=1, 1 wallclock secs ( 0.02 usr 0.01 sys + 1.16 cusr 0.27 csys = 1.46 CPU) Result: PASS Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Created attachment 169967 [details] [review] Bug 37490: Add a test to detect when yarn.lock is not updated to test... 1/ set koha repo to state where yarn.lock is not updated $ git reset --hard 67db70d4 2/ run test, observe FAIL $ prove ./xt/verify-yarnlock.t ./xt/verify-yarnlock.t .. error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`. ./xt/verify-yarnlock.t .. 1/1 # Failed test 'verify yarn.lock file is updated correctly' ... Result: FAIL 3/ set koha repo to state where yarn.lock is updated $ yarn install 4/ note yarn.lock is now updated $ git status ... modified: yarn.lock 5/ run test, observe SUCCESS $ prove -v ./xt/verify-yarnlock.t ./xt/verify-yarnlock.t .. ok 1 - verify yarn.lock file is updated correctly All tests successful. Files=1, Tests=1, 1 wallclock secs ( 0.02 usr 0.01 sys + 1.16 cusr 0.27 csys = 1.46 CPU) Result: PASS NOTE: i improved the test to handle running inside KTD, and using KTD's existing .cache/yarn and node_modules dirs Created attachment 170540 [details] [review] Bug 37490: Add a test to detect when yarn.lock is not updated to test... 1/ set koha repo to state where yarn.lock is not updated $ git reset --hard 67db70d4 2/ run test, observe FAIL $ prove ./xt/verify-yarnlock.t ./xt/verify-yarnlock.t .. error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`. ./xt/verify-yarnlock.t .. 1/1 # Failed test 'verify yarn.lock file is updated correctly' ... Result: FAIL 3/ set koha repo to state where yarn.lock is updated $ yarn install 4/ note yarn.lock is now updated $ git status ... modified: yarn.lock 5/ run test, observe SUCCESS $ prove -v ./xt/verify-yarnlock.t ./xt/verify-yarnlock.t .. ok 1 - verify yarn.lock file is updated correctly All tests successful. Files=1, Tests=1, 1 wallclock secs ( 0.02 usr 0.01 sys + 1.16 cusr 0.27 csys = 1.46 CPU) Result: PASS Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Never a bad idea to have more tests and catch these cases. Passing QA Ok, this test is failing for me on main... HELP? # Failed test 'verify yarn.lock file is updated correctly' # at /kohadevbox/koha/xt/verify-yarnlock.t line 45. # got: '256' # expected: '0' # Looks like you failed 1 test of 1. /kohadevbox/koha/xt/verify-yarnlock.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests Also: could someone explain when yarn.lock needs updating and how this is done? (In reply to Katrin Fischer from comment #8) > Also: could someone explain when yarn.lock needs updating and how this is > done? I retried it and it passes now! Pushed for 24.11! Well done everyone, thank you! I am wondering if this is working correctly. kohadev-koha@kohadevbox:koha$ prove xt/verify-yarnlock.t [skip lot of warnings] error "eslint-plugin-prettier##prettier@>=3.0.0" doesn't satisfy found match of "prettier@2.7.1" [skip lot of warnings] error Found 1 errors. xt/verify-yarnlock.t .. 1/1 # Failed test 'verify yarn.lock file is updated correctly' # at xt/verify-yarnlock.t line 45. # got: '256' # expected: '0' # Looks like you failed 1 test of 1. xt/verify-yarnlock.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests Test Summary Report ------------------- xt/verify-yarnlock.t (Wstat: 256 (exited 1) Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=1, Tests=1, 31 wallclock secs ( 0.07 usr 0.08 sys + 26.96 cusr 23.01 csys = 50.12 CPU) Result: FAIL I was wondering what could happen and first I've removed my local node_modules (/kohadevbox/koha/node_modules) Then the tests passed! You can recreate easily, go on the host and run `yarn install` to generate the node_modes dir, then run the tests. |