1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-08 23:25:51 +01:00
verdaccio/test/integration/test.pl

50 lines
1.5 KiB
Perl
Raw Normal View History

2013-12-30 09:25:26 +01:00
#!/usr/bin/perl
# note to readers: in perl it's useful, in javascript it isn't
use strict;
# setting up working environment && chdir there
use Cwd 'abs_path';
use File::Basename;
2016-11-07 18:15:38 +01:00
$ENV{HOME} = dirname(abs_path( __FILE__ )) . '/.verdaccio_test_env';
system('rm -rf .verdaccio_test_env ; mkdir .verdaccio_test_env') and quit('fail');
2013-12-30 09:25:26 +01:00
chdir $ENV{HOME};
use Data::Dumper;
my $pid;
sub quit {
print $_[0]."\n";
exec("kill $pid ; exit 1");
}
2016-11-07 18:15:38 +01:00
# run verdaccio in a child process
2013-12-30 09:25:26 +01:00
if (($pid = fork()) == 0) {
2016-11-07 18:15:38 +01:00
exec "../../../bin/verdaccio ../config.yaml";
2013-12-30 09:25:26 +01:00
die "exec failed";
}
system('mkdir node_modules') and quit('fail');
2016-11-07 18:15:38 +01:00
system('npm set verdaccio_test_config 12345') and quit('fail');
2013-12-30 09:25:26 +01:00
2016-11-07 18:15:38 +01:00
if (`cat .npmrc` !~ /verdaccio_test_config/) {
2013-12-30 09:25:26 +01:00
quit "npm is using wrong config";
}
system('npm set registry http://localhost:55501') and quit('fail');
system(q{/bin/echo -e 'test\ntest\ns@s.s\n' | npm adduser}) and quit('fail');
system('npm install jju') and quit('fail');
(`node -e 'console.log(require("jju").parse("{qwerty:123}").qwerty+456)'` =~ /579/) or quit('fail');
2016-11-07 18:15:38 +01:00
system('npm publish ../verdaccio-test-1.2.3.tgz') and quit('fail');
2017-03-04 00:39:26 +01:00
system('npm dist-tag add verdaccio-test@1.2.3 meow') and quit('fail');
2016-11-07 18:15:38 +01:00
system('npm install verdaccio-test@meow') and quit('fail');
2013-12-30 09:25:26 +01:00
2016-11-07 18:15:38 +01:00
(`node -e 'require("verdaccio-test")'` =~ /w==w/) or quit('fail');
2013-12-30 09:25:26 +01:00
quit("
==================================================================
All tests seem to be executed successfully, nothing is broken yet.
==================================================================");