From 9427890798c0e9b87cf13d39c50bc637f7989c7e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Aug 2022 15:16:56 +0200 Subject: Add more tests for plugin rebuild --- server/tests/api/server/plugins.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts index 3ae99dc2e..15c093758 100644 --- a/server/tests/api/server/plugins.ts +++ b/server/tests/api/server/plugins.ts @@ -353,6 +353,13 @@ describe('Test plugins', function () { }) it('Should rebuild native modules on Node ABI change', async function () { + this.timeout(50000) + + const removeNativeModule = async () => { + await remove(join(baseNativeModule, 'build')) + await remove(join(baseNativeModule, 'prebuilds')) + } + await command.install({ path: PluginsCommand.getPluginTestPath('-native') }) await makeGetRequest({ @@ -365,20 +372,33 @@ describe('Test plugins', function () { await server.sql.updateQuery(query) const baseNativeModule = server.servers.buildDirectory(join('plugins', 'node_modules', 'a-native-example')) - await remove(join(baseNativeModule, 'build')) - await remove(join(baseNativeModule, 'prebuilds')) + await removeNativeModule() await server.kill() await server.run() - await pathExists(join(baseNativeModule, 'build')) - await pathExists(join(baseNativeModule, 'prebuilds')) + expect(await pathExists(join(baseNativeModule, 'build'))).to.be.true + expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.true await makeGetRequest({ url: server.url, path: '/plugins/test-native/router', expectedStatus: HttpStatusCode.NO_CONTENT_204 }) + + await removeNativeModule() + + await server.kill() + await server.run() + + expect(await pathExists(join(baseNativeModule, 'build'))).to.be.false + expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.false + + await makeGetRequest({ + url: server.url, + path: '/plugins/test-native/router', + expectedStatus: HttpStatusCode.NOT_FOUND_404 + }) }) after(async function () { -- cgit v1.2.3