1. upgrade vulnerable package
2. fix test unit
This commit is contained in:
@@ -14,31 +14,32 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
let test = require('tap-only');
|
||||
let check = require("../src/main");
|
||||
let path = require('path');
|
||||
let check = require("../dist/main");
|
||||
|
||||
test('main - empty dir', function (t) {
|
||||
check.checkProject('fixtures/empty-dir', 'fake endpoint').then(function (res) {
|
||||
check.checkProject(path.resolve(__dirname, 'fixtures/empty-dir'), 'fake endpoint').then(function (res) {
|
||||
t.fail('empty dir should not succeed', res);
|
||||
}).catch(function (e) {
|
||||
t.type(e, 'Error', 'error received');
|
||||
t.notEqual(e.message.indexOf(' is not a node project'), -1, 'error is correct');
|
||||
t.not(e.message.indexOf(' is not a node project'), -1, 'error is correct');
|
||||
}).then(t.end);
|
||||
});
|
||||
|
||||
test('main - none exist dir', function (t) {
|
||||
check.checkProject('fixtures/im_not_exist', 'fake endpoint').then(function (res) {
|
||||
check.checkProject(path.resolve(__dirname, 'fixtures/im_not_exist'), 'fake endpoint').then(function (res) {
|
||||
t.fail('none exist dir should not succeed', res);
|
||||
}).catch(function (e) {
|
||||
t.type(e, 'Error', 'error received');
|
||||
t.notEqual(e.message.indexOf('dir is not exists'), -1, 'error is correct');
|
||||
t.not(e.message.indexOf('dir is not exists'), -1, 'error is correct');
|
||||
}).then(t.end);
|
||||
});
|
||||
|
||||
test('main - pkg-not-install', function (t) {
|
||||
check.checkProject('fixtures/pkg-not-install', 'fake endpoint').then(function (res) {
|
||||
check.checkProject(path.resolve(__dirname, 'fixtures/pkg-not-install'), 'fake endpoint').then(function (res) {
|
||||
t.fail('not install pkg dir should not succeed.', res)
|
||||
}).catch(function (e) {
|
||||
t.type(e, 'Error', 'error received');
|
||||
t.notEqual(e.message.indexOf("run 'npm install' first"), -1, 'error is correct')
|
||||
t.not(e.message.indexOf("run 'npm install' first"), -1, 'error is correct')
|
||||
}).then(t.end);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user