diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/server/plugins.ts | 28 |
1 files changed, 24 insertions, 4 deletions
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 () { | |||
353 | }) | 353 | }) |
354 | 354 | ||
355 | it('Should rebuild native modules on Node ABI change', async function () { | 355 | it('Should rebuild native modules on Node ABI change', async function () { |
356 | this.timeout(50000) | ||
357 | |||
358 | const removeNativeModule = async () => { | ||
359 | await remove(join(baseNativeModule, 'build')) | ||
360 | await remove(join(baseNativeModule, 'prebuilds')) | ||
361 | } | ||
362 | |||
356 | await command.install({ path: PluginsCommand.getPluginTestPath('-native') }) | 363 | await command.install({ path: PluginsCommand.getPluginTestPath('-native') }) |
357 | 364 | ||
358 | await makeGetRequest({ | 365 | await makeGetRequest({ |
@@ -365,20 +372,33 @@ describe('Test plugins', function () { | |||
365 | await server.sql.updateQuery(query) | 372 | await server.sql.updateQuery(query) |
366 | 373 | ||
367 | const baseNativeModule = server.servers.buildDirectory(join('plugins', 'node_modules', 'a-native-example')) | 374 | const baseNativeModule = server.servers.buildDirectory(join('plugins', 'node_modules', 'a-native-example')) |
368 | await remove(join(baseNativeModule, 'build')) | ||
369 | await remove(join(baseNativeModule, 'prebuilds')) | ||
370 | 375 | ||
376 | await removeNativeModule() | ||
371 | await server.kill() | 377 | await server.kill() |
372 | await server.run() | 378 | await server.run() |
373 | 379 | ||
374 | await pathExists(join(baseNativeModule, 'build')) | 380 | expect(await pathExists(join(baseNativeModule, 'build'))).to.be.true |
375 | await pathExists(join(baseNativeModule, 'prebuilds')) | 381 | expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.true |
376 | 382 | ||
377 | await makeGetRequest({ | 383 | await makeGetRequest({ |
378 | url: server.url, | 384 | url: server.url, |
379 | path: '/plugins/test-native/router', | 385 | path: '/plugins/test-native/router', |
380 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 386 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
381 | }) | 387 | }) |
388 | |||
389 | await removeNativeModule() | ||
390 | |||
391 | await server.kill() | ||
392 | await server.run() | ||
393 | |||
394 | expect(await pathExists(join(baseNativeModule, 'build'))).to.be.false | ||
395 | expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.false | ||
396 | |||
397 | await makeGetRequest({ | ||
398 | url: server.url, | ||
399 | path: '/plugins/test-native/router', | ||
400 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | ||
401 | }) | ||
382 | }) | 402 | }) |
383 | 403 | ||
384 | after(async function () { | 404 | after(async function () { |