Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update node version #622

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const config: KnipConfig = {
'i18next-parser',
'luxon', // Used in tests
'playwright', // Used in test configs
'sharp', // Requirement for @vite-pwa/assets-generator
'tsconfig-paths', // Used for e2e test setup
'virtual:pwa-register', // Service Worker code is injected at build time
'virtual:polyfills', // Polyfills are conditionally injected
Expand Down
17 changes: 17 additions & 0 deletions platforms/access-bridge/test/unit/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,26 @@ import * as Sentry from '@sentry/node';
import logger from '../../src/pipeline/logger.js';

describe('Logger Tests', () => {
// Preserve the original console methods
const originalConsole = { ...console };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use a logger service this one may help:

  mockService(
    LogTransporter,
    __debug__
      ? new ConsoleTransporter(LogLevel.DEBUG)
      : {
          log() {},
        },
  );

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I am using access bridge specific logger.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible that the memory issue we are facing is connected because the logger was outputting error objects.


beforeEach(() => {
// Reset all mocks to ensure a clean slate for each test
vi.resetAllMocks();

// Mock console methods to suppress log outputs during tests
// Suppressing info output to avoid clutter
global.console = {
log: () => {},
error: () => {},
warn: () => {},
info: () => {},
} as unknown as Console;
});

afterEach(() => {
// Restore the original console methods after each test
global.console = originalConsole;
});

describe('when Sentry is configured', () => {
Expand Down
2 changes: 1 addition & 1 deletion platforms/access-bridge/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default ({ mode, command }: ConfigEnv): UserConfigExport => {
},
test: {
globals: true,
include: ['**/*.test.ts'],
environment: 'node',
setupFiles: 'test/vitest.setup.ts',
chaiConfig: {
truncateThreshold: 1000,
Expand Down
Loading