From 3a23ddaba5337bf31bb80aa71a8d6a94203a764d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 4 May 2020 14:23:45 -0400 Subject: [PATCH] feat: move plugin tests to separate file --- test/plugins-installed.js | 21 +++++++++++++++++++++ test/plugins.js | 14 -------------- 2 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 test/plugins-installed.js diff --git a/test/plugins-installed.js b/test/plugins-installed.js new file mode 100644 index 0000000000..0401248f69 --- /dev/null +++ b/test/plugins-installed.js @@ -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); + } + } + }); +}); diff --git a/test/plugins.js b/test/plugins.js index d840a030cc..a029d06c06 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -11,20 +11,6 @@ var db = require('./mocks/databasemock'); var plugins = require('../src/plugins'); describe('Plugins', function () { - describe('Installed Plugins', async function () { - const installedPlugins = await plugins.showInstalled(); - installedPlugins.forEach((plugin) => { - const pathToTests = path.join(__dirname, '../node_modules', plugin.id, 'test'); - try { - require(pathToTests); - } catch (err) { - if (err.code !== 'MODULE_NOT_FOUND') { - console.log(err.stack); - } - } - }); - }); - it('should load plugin data', function (done) { var pluginId = 'nodebb-plugin-markdown'; plugins.loadPlugin(path.join(nconf.get('base_dir'), 'node_modules/' + pluginId), function (err) {