From 639ca8ac094c3735755c5bf1360f62f62949b339 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Mon, 12 May 2025 16:06:23 +0200
Subject: [PATCH] Bug 39877: Merge vue and js tidy tests

---
 xt/js_tidy.t  | 18 +++++++++++++-----
 xt/vue_tidy.t | 31 -------------------------------
 2 files changed, 13 insertions(+), 36 deletions(-)
 delete mode 100755 xt/vue_tidy.t

diff --git a/xt/js_tidy.t b/xt/js_tidy.t
index 940f2b622c5..fbb460cee61 100755
--- a/xt/js_tidy.t
+++ b/xt/js_tidy.t
@@ -1,4 +1,4 @@
-#/usr/bin/perl
+#!/usr/bin/perl
 
 # This file is part of Koha.
 #
@@ -17,15 +17,23 @@
 
 use Modern::Perl;
 use File::Slurp qw( read_file );
+use Test::NoWarnings;
 use Test::More;
 
-my @js_files = qx{git ls-files '*.js' '*.ts'};
+use Koha::Devel::CI::IncrementalRuns;
 
-plan tests => scalar @js_files;
+my $ci = Koha::Devel::CI::IncrementalRuns->new( { context => 'tidy' } );
 
-foreach my $filepath (@js_files) {
+my @files = $ci->get_files_to_test('js');
+
+plan tests => scalar @files + 1;
+
+my %results;
+foreach my $filepath (@files) {
     chomp $filepath;
     my $tidy    = qx{perl misc/devel/tidy.pl --silent --no-write $filepath};
     my $content = read_file $filepath;
-    ok( $content eq $tidy, "$filepath should be kept tidy" );
+    ok( $content eq $tidy, "$filepath should be kept tidy" ) or $results{$filepath} = 1;
 }
+
+$ci->report_results( \%results );
diff --git a/xt/vue_tidy.t b/xt/vue_tidy.t
deleted file mode 100755
index 03ab5033088..00000000000
--- a/xt/vue_tidy.t
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/perl
-
-# 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>.
-
-use Modern::Perl;
-use File::Slurp qw( read_file );
-use Test::More;
-
-my @vue_files = `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.vue'`;
-
-plan tests => scalar @vue_files;
-
-foreach my $filepath (@vue_files) {
-    chomp $filepath;
-    my $tidy    = qx{perl misc/devel/tidy.pl --silent --no-write $filepath};
-    my $content = read_file $filepath;
-    ok( $content eq $tidy, "$filepath should be kept tidy" );
-}
-- 
2.34.1