From ea6f3a1d9c80f8a609109e1cef40a98138af8291 Mon Sep 17 00:00:00 2001 From: Daan Kets Date: Thu, 8 Feb 2018 11:23:51 +0100 Subject: [PATCH] Added one test case, fixed a small bug - Additional test case for @scope/module@tag - Fixed a bug for checking the position of the last @ in the module name, that could trigger on -1. --- lib/Utility.js | 2 +- test/interface/utility.mocha.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Utility.js b/lib/Utility.js index d0e3ab672..a0617db68 100644 --- a/lib/Utility.js +++ b/lib/Utility.js @@ -229,7 +229,7 @@ var Utility = module.exports = { } //pm2 install @somescope/module@2.1.0-beta - if(canonic_module_name.lastIndexOf('@') !== 0) { + if(canonic_module_name.lastIndexOf('@') > 0) { canonic_module_name = canonic_module_name.substr(0,canonic_module_name.lastIndexOf("@")); } diff --git a/test/interface/utility.mocha.js b/test/interface/utility.mocha.js index 1cb89389a..d2c1c7bd3 100644 --- a/test/interface/utility.mocha.js +++ b/test/interface/utility.mocha.js @@ -19,6 +19,7 @@ describe('Utility', function() { assert(Utility.getCanonicModuleName('ma-zal/pm2-slack#own-branch') === 'pm2-slack'); assert(Utility.getCanonicModuleName('pm2-slack') === 'pm2-slack'); assert(Utility.getCanonicModuleName('@org/pm2-slack') === '@org/pm2-slack'); + assert(Utility.getCanonicModuleName('@org/pm2-slack@latest') === '@org/pm2-slack'); assert(Utility.getCanonicModuleName('git+https://github.com/user/pm2-slack') === 'pm2-slack'); assert(Utility.getCanonicModuleName('git+https://github.com/user/pm2-slack.git') === 'pm2-slack'); assert(Utility.getCanonicModuleName('file:///home/user/pm2-slack') === 'pm2-slack');