Bugzilla – Attachment 150513 Details for
Bug 33625
Enforce formatting on vue .js and .ts files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33625: Add test
Bug-33625-Add-test.patch (text/plain), 1.95 KB, created by
Martin Renvoize (ashimema)
on 2023-05-02 11:07:30 UTC
(
hide
)
Description:
Bug 33625: Add test
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-05-02 11:07:30 UTC
Size:
1.95 KB
patch
obsolete
>From d39de11774f4876000bb07edd606e469b0ce8ade Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 2 May 2023 10:32:11 +0200 >Subject: [PATCH] Bug 33625: Add test > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > xt/vue_tidy.t | 30 ++++++++++++++++++++++++++---- > 1 file changed, 26 insertions(+), 4 deletions(-) > >diff --git a/xt/vue_tidy.t b/xt/vue_tidy.t >index 122aea1f50..7052e6f882 100755 >--- a/xt/vue_tidy.t >+++ b/xt/vue_tidy.t >@@ -20,17 +20,17 @@ use File::Slurp qw( read_file ); > use File::Find; > use FindBin(); > use Data::Dumper qw( Dumper ); >-use Test::More tests => 1; >+use Test::More tests => 2; > > my $vue_dir = "$FindBin::Bin/../koha-tmpl/intranet-tmpl/prog/js/vue"; > > my @files; >-sub wanted { >+sub wanted_vue { > my $name = $File::Find::name; > push @files, $name > if $name =~ /\.vue$/; > } >-find({ wanted => \&wanted, no_chdir => 1 }, $vue_dir); >+find({ wanted => \&wanted_vue, no_chdir => 1 }, $vue_dir); > > my @not_tidy; > foreach my $filepath (@files) { >@@ -42,4 +42,26 @@ foreach my $filepath (@files) { > } > } > >-is(scalar(@not_tidy), 0, 'No vue file should be messy') or diag Dumper \@not_tidy; >+is(scalar(@not_tidy), 0, 'No .vue file should be messy') or diag Dumper \@not_tidy; >+ >+@files = (); >+sub wanted_js_ts { >+ my $name = $File::Find::name; >+ push @files, $name >+ if ( $name =~ /\.js$/ >+ || $name =~ /\.ts$/ ) >+ && $name !~ m{koha-tmpl/intranet-tmpl/prog/js/vue/dist}; # Exclude dist >+} >+find({ wanted => \&wanted_js_ts, no_chdir => 1 }, $vue_dir); >+ >+@not_tidy = (); >+foreach my $filepath (@files) { >+ chomp $filepath; >+ my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --arrow-parens avoid $filepath}; >+ my $content = read_file $filepath; >+ if ( $content ne $tidy ) { >+ push @not_tidy, $filepath; >+ } >+} >+ >+is(scalar(@not_tidy), 0, 'No js file from vue directory should be messy') or diag Dumper \@not_tidy; >-- >2.40.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33625
:
150508
|
150509
| 150513 |
150514
|
151331
|
151332