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>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8f0dc36f0d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e4b57f0aa0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
5522a622fc
commit
0dd483c871
|
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright (C) 2024 KohaAloha Ltd.
|
||||
#
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
# This file tests that Koha's yarn.lock file is updated with the
|
||||
# packages.json file. If this test fails, the likely solution is to run
|
||||
# 'yarn install' to generate an updated yarn.lock file, then
|
||||
# 'git commit ./yarn.lock'.
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::More tests => 1;
|
||||
|
||||
my $rc;
|
||||
|
||||
# if KTD dirs exists?
|
||||
if ( -d "/usr/local/share/.cache/yarn" and -d "/kohadevbox/node_modules" ) {
|
||||
|
||||
# we use KTD's existing .cache/yarn and node_modules dirs
|
||||
$rc = system("yarn check --modules-folder /kohadevbox/node_modules --cache-dir /usr/local/share/.cache/yarn");
|
||||
|
||||
} else {
|
||||
|
||||
# else, we just use yarn's currently set dirs
|
||||
$rc = system("yarn check");
|
||||
|
||||
}
|
||||
|
||||
# yarn returns a 256 value for this specific lockfile error,
|
||||
# but we assume any non-zero value is bad
|
||||
is( $rc, 0, "verify yarn.lock file is updated correctly" );
|
||||
Loading…
Reference in New Issue