Buckets:
| import path from 'path' | |
| import os from 'os' | |
| import { | |
| throwTurbopackInternalError, | |
| TurbopackInternalError, | |
| } from 'next/dist/shared/lib/turbopack/internal-error' | |
| import { Telemetry } from 'next/dist/telemetry/storage' | |
| import { setGlobal } from 'next/dist/trace' | |
| import { traceGlobals } from 'next/dist/trace/shared' | |
| describe('TurbopackInternalError', () => { | |
| it('sends a telemetry event when throwTurbopackInternalError() is called', async () => { | |
| const oldTelemetry = traceGlobals.get('telemetry') | |
| try { | |
| const distDir = path.join(os.tmpdir(), 'next-telemetry') | |
| const telemetry = new Telemetry({ distDir }) | |
| setGlobal('telemetry', telemetry) | |
| const submitRecord = jest | |
| // @ts-ignore | |
| .spyOn(telemetry, 'submitRecord') | |
| // @ts-ignore | |
| .mockImplementation(() => Promise.resolve()) | |
| let internalError = null | |
| try { | |
| throwTurbopackInternalError(null, { | |
| message: 'test error', | |
| anonymizedLocation: 'file.rs:120:1', | |
| }) | |
| } catch (err) { | |
| internalError = err | |
| } | |
| expect(internalError).toBeInstanceOf(TurbopackInternalError) | |
| expect(submitRecord).toHaveBeenCalledWith({ | |
| eventName: 'NEXT_ERROR_THROWN', | |
| payload: { | |
| errorCode: 'TurbopackInternalError', | |
| location: 'file.rs:120:1', | |
| }, | |
| }) | |
| } finally { | |
| setGlobal('telemetry', oldTelemetry) | |
| } | |
| }) | |
| }) | |
Xet Storage Details
- Size:
- 1.44 kB
- Xet hash:
- 4251677ccd367d02e510b0217b54f4481a436ab30a05ba5da899cc2ae062f922
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.