Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
test: move tests to dedicated test folder (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa authored Dec 7, 2023
1 parent d5b0029 commit 7e4e648
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/bindings.test.ts → test/bindings.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Contains unit tests for some of the C++ bindings. These functions
// are exported on the private bindings object, so we can test them and
// they should not be used outside of this file.
import { PrivateCpuProfilerBindings } from './cpu_profiler';
import { PrivateCpuProfilerBindings } from '../src/cpu_profiler';
import { platform } from 'os';

const cases = [
Expand Down
4 changes: 2 additions & 2 deletions src/cpu_profiler.test.ts → test/cpu_profiler.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CpuProfilerBindings, PrivateCpuProfilerBindings } from './cpu_profiler';
import type { ThreadCpuProfile, RawThreadCpuProfile } from './types';
import { CpuProfilerBindings, PrivateCpuProfilerBindings } from '../src/cpu_profiler';
import type { ThreadCpuProfile, RawThreadCpuProfile } from '../src/types';

// Required because we test a hypothetical long profile
// and we cannot use advance timers as the c++ relies on
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as Sentry from '@sentry/node';

import { ProfilingIntegration } from './index';
import { CpuProfilerBindings } from './cpu_profiler';
import { ProfilingIntegration } from '../src/index';
import { CpuProfilerBindings } from '../src/cpu_profiler';
import { logger, createEnvelope } from '@sentry/utils';
import { GLOBAL_OBJ } from '@sentry/utils';
import { NodeClient } from '@sentry/node';
Expand Down
4 changes: 2 additions & 2 deletions src/hubextensions.test.ts → test/hubextensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type {

import type { NodeClient } from '@sentry/node';

import { __PRIVATE__wrapStartTransactionWithProfiling } from './hubextensions';
import { CpuProfilerBindings } from './cpu_profiler';
import { __PRIVATE__wrapStartTransactionWithProfiling } from '../src/hubextensions';
import { CpuProfilerBindings } from '../src/cpu_profiler';

function makeTransactionMock(options = {}): Transaction {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/index.test.ts → test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as Sentry from '@sentry/node';
import type { Transport } from '@sentry/types';

import { ProfilingIntegration } from './index';
import { ProfilingIntegration } from '../src/index';
import { NodeClient } from '@sentry/node';
import { getMainCarrier } from '@sentry/core';
import type { Profile } from './types';
import type { Profile } from '../src/types';

interface MockTransport extends Transport {
events: any[];
Expand Down
4 changes: 2 additions & 2 deletions src/integration.test.ts → test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { EventEmitter } from 'events';
import { logger } from '@sentry/utils';
import type { Event, Hub, Transport } from '@sentry/types';

import { ProfilingIntegration } from './integration';
import type { ProfiledEvent } from './types';
import { ProfilingIntegration } from '../src/integration';
import type { ProfiledEvent } from '../src/types';

function assertCleanProfile(event: ProfiledEvent | Event): void {
expect(event.sdkProcessingMetadata?.profile).toBeUndefined();
Expand Down
10 changes: 7 additions & 3 deletions src/utils.test.ts → test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import {
isValidProfile,
addProfilesToEnvelope,
findProfiledTransactionsFromEnvelope
} from './utils';
} from '../src/utils';

import { maybeRemoveProfileFromSdkMetadata, isProfiledTransactionEvent, createProfilingEventEnvelope } from './utils';
import type { Profile, ProfiledEvent } from './types';
import {
maybeRemoveProfileFromSdkMetadata,
isProfiledTransactionEvent,
createProfilingEventEnvelope
} from '../src/utils';
import type { Profile, ProfiledEvent } from '../src/types';

function makeSdkMetadata(props: Partial<SdkMetadata['sdk']>): SdkMetadata {
return {
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"checkJs": false,
"allowJs": true,
"declaration": false,
"baseUrl": "./src",
"typeRoots": ["node_modules/@types"],
"typeRoots": ["node_modules/@types"]
},
"types": ["./src/types.d.ts"],
"exclude": ["src/**/*.test.ts", "scripts/**/*"]
Expand Down

0 comments on commit 7e4e648

Please sign in to comment.