Skip to content

Commit

Permalink
test(core): Mock filesystem in tests (#10823)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov authored Sep 17, 2024
1 parent a6e1064 commit d14bb36
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { rmSync } from 'fs';
import { writeFile as fsWriteFile, rm as fsRm } from 'fs/promises';
import { Credentials, InstanceSettings } from 'n8n-core';
import { ApplicationError, type ICredentialDataDecryptedObject } from 'n8n-workflow';
import { writeFile as fsWriteFile, rm as fsRm } from 'node:fs/promises';
import path from 'path';
import Container, { Service } from 'typedi';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
import { In } from '@n8n/typeorm';
import glob from 'fast-glob';
import { readFile as fsReadFile } from 'fs/promises';
import { Credentials, InstanceSettings } from 'n8n-core';
import { ApplicationError, jsonParse, ErrorReporterProxy as ErrorReporter } from 'n8n-workflow';
import { readFile as fsReadFile } from 'node:fs/promises';
import path from 'path';
import { Container, Service } from 'typedi';

Expand Down
2 changes: 2 additions & 0 deletions packages/cli/test/integration/webhooks.api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import type { SuperAgentTest } from './shared/types';
import { initActiveWorkflowManager } from './shared/utils';
import { mockInstance } from '../shared/mocking';

jest.unmock('node:fs');

mockInstance(Telemetry);

describe('Webhook API', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/test/setup-mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ jest.mock('@n8n_io/license-sdk');
jest.mock('@/telemetry');
jest.mock('@/eventbus/message-event-bus/message-event-bus');
jest.mock('@/push');
jest.mock('node:fs');
jest.mock('node:fs/promises');

0 comments on commit d14bb36

Please sign in to comment.