Skip to content
Merged
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
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"clean": "rimraf build coverage sentry-core-*.tgz",
"fix": "eslint . --format stylish --fix",
"lint": "eslint . --format stylish",
"test": "jest",
"test:watch": "jest --watch",
"test": "vitest run",
"test:watch": "vitest --watch",
"yalc:publish": "yalc publish --push --sig"
},
"volta": {
Expand Down
12 changes: 7 additions & 5 deletions packages/core/src/utils-hoist/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ interface CryptoGlobal {
crypto?: CryptoInternal;
}

function getCrypto(): CryptoInternal | undefined {
const gbl = GLOBAL_OBJ as typeof GLOBAL_OBJ & CryptoGlobal;
return gbl.crypto || gbl.msCrypto;
}

/**
* UUID4 generator
*
* @param crypto Object that provides the crypto API.
* @returns string Generated UUID4.
*/
export function uuid4(): string {
const gbl = GLOBAL_OBJ as typeof GLOBAL_OBJ & CryptoGlobal;
const crypto = gbl.crypto || gbl.msCrypto;

export function uuid4(crypto = getCrypto()): string {
let getRandomByte = (): number => Math.random() * 16;
try {
if (crypto?.randomUUID) {
Expand Down
1 change: 1 addition & 0 deletions packages/core/test/lib/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, test } from 'vitest';
import { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from '../../src/api';
import type { DsnComponents, SdkInfo } from '../../src/types-hoist';
import { makeDsn } from '../../src/utils-hoist/dsn';
Expand Down
3 changes: 2 additions & 1 deletion packages/core/test/lib/attachments.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import { createTransport } from '../../src/transports/base';
import { parseEnvelope } from '../../src/utils-hoist/envelope';
import { TestClient, getDefaultTestClientOptions } from '../mocks/client';
Expand All @@ -9,7 +10,7 @@ describe('Attachments', () => {
});

afterEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
});

test('actually end up in envelope', async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/core/test/lib/carrier.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'vitest';
import { getSentryCarrier } from '../../src/carrier';
import { SDK_VERSION } from '../../src/utils-hoist/version';

Expand Down
2 changes: 2 additions & 0 deletions packages/core/test/lib/checkin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type { SerializedCheckIn } from '../../src/types-hoist';

import { createCheckInEnvelope } from '../../src/checkin';

import { describe, expect, test } from 'vitest';

describe('createCheckInEnvelope', () => {
test('creates a check in envelope header', () => {
const envelope = createCheckInEnvelope(
Expand Down
Loading
Loading