feat: move plugin tests to separate file

This commit is contained in:
Barış Soner Uşaklı
2020-05-04 14:23:45 -04:00
parent a72e44290b
commit 3a23ddaba5
2 changed files with 21 additions and 14 deletions

21
test/plugins-installed.js Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
const path = require('path');
const fs = require('fs');
const db = require('./mocks/databasemock');
const installedPlugins = fs.readdirSync(path.join(__dirname, '../node_modules'))
.filter(p => p.startsWith('nodebb-'));
describe('Installed Plugins', function () {
installedPlugins.forEach((plugin) => {
const pathToTests = path.join(__dirname, '../node_modules', plugin, 'test');
try {
require(pathToTests);
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND') {
console.log(err.stack);
}
}
});
});