mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-02 07:43:11 +03:00
f50224f445
refs https://github.com/TryGhost/Team/issues/2667 Some tests still accessed the internet. Now network access is disabled by default. This change also introduces two helper methods related to networking (mocking Slack and Mailgun). This fixes two unreliable tests: - Staff service was accessing a Slack test API -> timeout possible - MentionSendingService was trying to send webmentions for every post publish/change -> possible timeouts and job issues
20 lines
616 B
JavaScript
20 lines
616 B
JavaScript
process.env.NODE_ENV = process.env.NODE_ENV || 'testing';
|
|
process.env.WEBHOOK_SECRET = process.env.WEBHOOK_SECRET || 'TEST_STRIPE_WEBHOOK_SECRET';
|
|
|
|
require('../../core/server/overrides');
|
|
|
|
const {mochaHooks} = require('@tryghost/express-test').snapshot;
|
|
exports.mochaHooks = mochaHooks;
|
|
|
|
const mockManager = require('./e2e-framework-mock-manager');
|
|
|
|
const originalBeforeAll = mochaHooks.beforeAll;
|
|
mochaHooks.beforeAll = async function () {
|
|
if (originalBeforeAll) {
|
|
await originalBeforeAll();
|
|
}
|
|
|
|
// Disable network in tests to prevent any accidental requests
|
|
mockManager.disableNetwork();
|
|
};
|