From 4c2e1e36ea59db26fd0d7b32de51ef3d41bd0ded Mon Sep 17 00:00:00 2001 From: Mason James Date: Fri, 26 Jul 2024 22:54:15 +1200 Subject: [PATCH] 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 --- xt/verify-yarnlock.t | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 xt/verify-yarnlock.t diff --git a/xt/verify-yarnlock.t b/xt/verify-yarnlock.t new file mode 100755 index 0000000000..9b5ba06410 --- /dev/null +++ b/xt/verify-yarnlock.t @@ -0,0 +1,30 @@ +#!/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 . + +# This runs 'xmllint' (part of libxml2-utils) over each xml file that +# generates the koha-common man pages and ensures they're correct. + +use Modern::Perl; +use Test::More tests => 1; + +# yarn returns a 256 value for this specific lockfile error, +# but we assume any non-zero value is bad +my $rc = system("yarn install --offline --frozen-lockfile --verbose"); + +is( $rc, 0, 'verify yarn.lock file is updated correctly' ); -- 2.30.2