Skip to content

Commit cf776c5

Browse files
msonnbcodex
andcommitted
test(v10/bundler-plugins): Skip unsupported Rolldown test on Node 18
Load Rolldown only inside its version-gated test so Node 18 can collect and run the remaining Rollup cases. Co-Authored-By: OpenAI GPT-6 <codex@openai.com>
1 parent e0f504f commit cf776c5

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

‎packages/bundler-plugins/test/rollup/disable-upload.test.ts‎

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import * as fs from 'fs';
22
import * as os from 'os';
33
import * as path from 'path';
44
import { rollup } from 'rollup';
5-
import { rolldown } from 'rolldown';
65
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
76
import { sentryRollupPlugin } from '../../src/rollup';
87
import { sentryVitePlugin } from '../../src/vite';
98

109
const DEBUG_ID_MARKER = /sentry-dbid-([0-9a-f-]{36})/;
10+
const NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0]!);
1111

1212
describe('sourcemaps.disable: "disable-upload"', () => {
1313
let tmpDir: string;
@@ -41,23 +41,28 @@ describe('sourcemaps.disable: "disable-upload"', () => {
4141
expect(chunk).toContain(`//# debugId=${debugId}`);
4242
});
4343

44-
it('stamps the emitted source map with the debug ID injected into the chunk (rolldown / vite)', async () => {
45-
const outDir = path.join(tmpDir, 'dist');
46-
const build = await rolldown({
47-
input: entry,
48-
plugins: sentryVitePlugin({ telemetry: false, sourcemaps: { disable: 'disable-upload' } }),
49-
});
50-
await build.write({ dir: outDir, sourcemap: true });
51-
52-
const chunk = fs.readFileSync(path.join(outDir, 'entry.js'), 'utf8');
53-
const map = JSON.parse(fs.readFileSync(path.join(outDir, 'entry.js.map'), 'utf8'));
54-
const debugId = chunk.match(DEBUG_ID_MARKER)?.[1];
55-
56-
expect(debugId).toBeDefined();
57-
expect(map.debug_id).toBe(debugId);
58-
expect(map.debugId).toBe(debugId);
59-
expect(chunk).toContain(`//# debugId=${debugId}`);
60-
});
44+
it.skipIf(NODE_MAJOR_VERSION < 20)(
45+
'stamps the emitted source map with the debug ID injected into the chunk (rolldown / vite)',
46+
async () => {
47+
// Rolldown uses Node APIs unavailable on Node 18, so importing it must also be skipped.
48+
const { rolldown } = await import('rolldown');
49+
const outDir = path.join(tmpDir, 'dist');
50+
const build = await rolldown({
51+
input: entry,
52+
plugins: sentryVitePlugin({ telemetry: false, sourcemaps: { disable: 'disable-upload' } }),
53+
});
54+
await build.write({ dir: outDir, sourcemap: true });
55+
56+
const chunk = fs.readFileSync(path.join(outDir, 'entry.js'), 'utf8');
57+
const map = JSON.parse(fs.readFileSync(path.join(outDir, 'entry.js.map'), 'utf8'));
58+
const debugId = chunk.match(DEBUG_ID_MARKER)?.[1];
59+
60+
expect(debugId).toBeDefined();
61+
expect(map.debug_id).toBe(debugId);
62+
expect(map.debugId).toBe(debugId);
63+
expect(chunk).toContain(`//# debugId=${debugId}`);
64+
},
65+
);
6166

6267
it('stamps a hidden source map that the chunk does not reference', async () => {
6368
const outDir = path.join(tmpDir, 'dist');

0 commit comments

Comments
 (0)