mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
test(core): Mock filesystem in tests (#10823)
This commit is contained in:
parent
a6e1064985
commit
d14bb36300
|
@ -1,7 +1,7 @@
|
||||||
import { rmSync } from 'fs';
|
import { rmSync } from 'fs';
|
||||||
import { writeFile as fsWriteFile, rm as fsRm } from 'fs/promises';
|
|
||||||
import { Credentials, InstanceSettings } from 'n8n-core';
|
import { Credentials, InstanceSettings } from 'n8n-core';
|
||||||
import { ApplicationError, type ICredentialDataDecryptedObject } from 'n8n-workflow';
|
import { ApplicationError, type ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||||
|
import { writeFile as fsWriteFile, rm as fsRm } from 'node:fs/promises';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import Container, { Service } from 'typedi';
|
import Container, { Service } from 'typedi';
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
|
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
|
||||||
import { In } from '@n8n/typeorm';
|
import { In } from '@n8n/typeorm';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
import { readFile as fsReadFile } from 'fs/promises';
|
|
||||||
import { Credentials, InstanceSettings } from 'n8n-core';
|
import { Credentials, InstanceSettings } from 'n8n-core';
|
||||||
import { ApplicationError, jsonParse, ErrorReporterProxy as ErrorReporter } from 'n8n-workflow';
|
import { ApplicationError, jsonParse, ErrorReporterProxy as ErrorReporter } from 'n8n-workflow';
|
||||||
|
import { readFile as fsReadFile } from 'node:fs/promises';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { Container, Service } from 'typedi';
|
import { Container, Service } from 'typedi';
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ import type { SuperAgentTest } from './shared/types';
|
||||||
import { initActiveWorkflowManager } from './shared/utils';
|
import { initActiveWorkflowManager } from './shared/utils';
|
||||||
import { mockInstance } from '../shared/mocking';
|
import { mockInstance } from '../shared/mocking';
|
||||||
|
|
||||||
|
jest.unmock('node:fs');
|
||||||
|
|
||||||
mockInstance(Telemetry);
|
mockInstance(Telemetry);
|
||||||
|
|
||||||
describe('Webhook API', () => {
|
describe('Webhook API', () => {
|
||||||
|
|
|
@ -5,3 +5,5 @@ jest.mock('@n8n_io/license-sdk');
|
||||||
jest.mock('@/telemetry');
|
jest.mock('@/telemetry');
|
||||||
jest.mock('@/eventbus/message-event-bus/message-event-bus');
|
jest.mock('@/eventbus/message-event-bus/message-event-bus');
|
||||||
jest.mock('@/push');
|
jest.mock('@/push');
|
||||||
|
jest.mock('node:fs');
|
||||||
|
jest.mock('node:fs/promises');
|
||||||
|
|
Loading…
Reference in a new issue