Description: upstream switched to vitest which is not available
Author: Yadd <yadd@debian.org>
Forwarded: not-needed
Last-Update: 2025-08-24

--- a/test/Bundle.test.js
+++ b/test/Bundle.test.js
@@ -1,23 +1,24 @@
-import { describe, it } from 'vitest';
-import assert from 'assert';
-import MagicString, { Bundle } from '../';
-import { SourceMapConsumer } from 'source-map-js';
+const assert = require('assert');
+const SourceMapConsumer = require('source-map-js').SourceMapConsumer;
+const MagicString = require('../');
 
-describe('Bundle', () => {
+require('source-map-support').install();
+
+describe('MagicString.Bundle', () => {
 	describe('addSource', () => {
 		it('should return this', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 			const source = new MagicString('abcdefghijkl');
 
 			assert.strictEqual(b.addSource({ content: source }), b);
 		});
 
 		it('should accept MagicString instance as a single argument', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 			const array = [];
 			const source = new MagicString('abcdefghijkl', {
 				filename: 'foo.js',
-				indentExclusionRanges: array,
+				indentExclusionRanges: array
 			});
 
 			b.addSource(source);
@@ -27,12 +28,12 @@
 		});
 
 		it('should accept ignore-list hint', () => {
-			const b = new Bundle();
-			const foo = new MagicString('foo', { filename: 'foo.js' });
-			const bar = new MagicString('bar', { filename: 'bar.js' });
+			const b = new MagicString.Bundle();
+			const foo = new MagicString('foo', {filename: 'foo.js'});
+			const bar = new MagicString('bar', {filename: 'bar.js'});
 
-			b.addSource({ content: foo, ignoreList: true });
-			b.addSource({ content: bar, ignoreList: false });
+			b.addSource({content: foo, ignoreList: true});
+			b.addSource({content: bar, ignoreList: false});
 			assert.strictEqual(b.sources[0].content, foo);
 			assert.strictEqual(b.sources[0].ignoreList, true);
 			assert.strictEqual(b.sources[1].content, bar);
@@ -40,12 +41,12 @@
 		});
 
 		it('respects MagicString init options with { content: source }', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 			const array = [];
 			const source = new MagicString('abcdefghijkl', {
 				filename: 'foo.js',
 				ignoreList: false,
-				indentExclusionRanges: array,
+				indentExclusionRanges: array
 			});
 
 			b.addSource({ content: source });
@@ -58,7 +59,7 @@
 
 	describe('append', () => {
 		it('should append content', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource({ content: new MagicString('*') });
 
@@ -67,7 +68,7 @@
 		});
 
 		it('should append content before subsequent sources', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource(new MagicString('*'));
 
@@ -76,7 +77,7 @@
 		});
 
 		it('should return this', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 			assert.strictEqual(b.append('x'), b);
 		});
 	});
@@ -85,7 +86,7 @@
 		it('should clone a bundle', () => {
 			const s1 = new MagicString('abcdef');
 			const s2 = new MagicString('ghijkl');
-			const b = new Bundle()
+			const b = new MagicString.Bundle()
 				.addSource({ content: s1 })
 				.addSource({ content: s2 })
 				.prepend('>>>')
@@ -102,20 +103,21 @@
 
 	describe('generateMap', () => {
 		it('should generate a sourcemap', () => {
-			const b = new Bundle()
+			const b = new MagicString.Bundle()
 				.addSource({
 					filename: 'foo.js',
-					content: new MagicString('var answer = 42;'),
+					content: new MagicString('var answer = 42;')
 				})
 				.addSource({
 					filename: 'bar.js',
-					content: new MagicString('console.log( answer );'),
+					content: new MagicString('console.log( answer );')
 				});
 
+
 			const map = b.generateMap({
 				file: 'bundle.js',
 				includeContent: true,
-				hires: true,
+				hires: true
 			});
 
 			assert.equal(map.version, 3);
@@ -148,20 +150,20 @@
 		});
 
 		it('should handle Windows-style paths', () => {
-			const b = new Bundle()
+			const b = new MagicString.Bundle()
 				.addSource({
 					filename: 'path\\to\\foo.js',
-					content: new MagicString('var answer = 42;'),
+					content: new MagicString('var answer = 42;')
 				})
 				.addSource({
 					filename: 'path\\to\\bar.js',
-					content: new MagicString('console.log( answer );'),
+					content: new MagicString('console.log( answer );')
 				});
 
 			const map = b.generateMap({
 				file: 'bundle.js',
 				includeContent: true,
-				hires: true,
+				hires: true
 			});
 
 			assert.equal(map.version, 3);
@@ -169,10 +171,7 @@
 			assert.deepEqual(map.sources, ['path/to/foo.js', 'path/to/bar.js']);
 			assert.deepEqual(map.sourcesContent, ['var answer = 42;', 'console.log( answer );']);
 
-			assert.equal(
-				map.toString(),
-				'{"version":3,"file":"bundle.js","sources":["path/to/foo.js","path/to/bar.js"],"sourcesContent":["var answer = 42;","console.log( answer );"],"names":[],"mappings":"AAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;ACAf,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}',
-			);
+			assert.equal(map.toString(), '{"version":3,"file":"bundle.js","sources":["path/to/foo.js","path/to/bar.js"],"sourcesContent":["var answer = 42;","console.log( answer );"],"names":[],"mappings":"AAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;ACAf,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}');
 
 			const smc = new SourceMapConsumer(map);
 			let loc;
@@ -199,23 +198,21 @@
 		});
 
 		it('should handle edge case with intro content', () => {
-			const b = new Bundle()
+			const b = new MagicString.Bundle()
 				.addSource({
 					filename: 'foo.js',
-					content: new MagicString('var answer = 42;'),
+					content: new MagicString('var answer = 42;')
 				})
 				.addSource({
 					filename: 'bar.js',
-					content: new MagicString('\nconsole.log( answer );'),
+					content: new MagicString('\nconsole.log( answer );')
 				})
-				.indent()
-				.prepend('(function () {\n')
-				.append('\n}());');
+				.indent().prepend('(function () {\n').append('\n}());');
 
 			const map = b.generateMap({
 				file: 'bundle.js',
 				includeContent: true,
-				hires: true,
+				hires: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -243,26 +240,26 @@
 		});
 
 		it('should allow missing file option when generating map', () => {
-			new Bundle()
+			new MagicString.Bundle()
 				.addSource({
 					filename: 'foo.js',
-					content: new MagicString('var answer = 42;'),
+					content: new MagicString('var answer = 42;')
 				})
 				.generateMap({
 					includeContent: true,
-					hires: true,
+					hires: true
 				});
 		});
 
 		it('should handle repeated sources', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			const foo = new MagicString('var one = 1;\nvar three = 3;', {
-				filename: 'foo.js',
+				filename: 'foo.js'
 			});
 
 			const bar = new MagicString('var two = 2;\nvar four = 4;', {
-				filename: 'bar.js',
+				filename: 'bar.js'
 			});
 
 			b.addSource(foo.snip(0, 12));
@@ -275,7 +272,7 @@
 
 			const map = b.generateMap({
 				includeContent: true,
-				hires: true,
+				hires: true
 			});
 
 			assert.equal(map.sources.length, 2);
@@ -306,7 +303,7 @@
 		});
 
 		it('should recover original names', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			const one = new MagicString('function one () {}', { filename: 'one.js' });
 			const two = new MagicString('function two () {}', { filename: 'two.js' });
@@ -320,7 +317,7 @@
 			const map = b.generateMap({
 				file: 'output.js',
 				source: 'input.js',
-				includeContent: true,
+				includeContent: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -334,7 +331,7 @@
 		});
 
 		it('should exclude sources without filename from sourcemap', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			const one = new MagicString('function one () {}', { filename: 'one.js' });
 			const two = new MagicString('function two () {}', { filename: null });
@@ -347,7 +344,7 @@
 			const map = b.generateMap({
 				file: 'output.js',
 				source: 'input.js',
-				includeContent: true,
+				includeContent: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -364,7 +361,7 @@
 		});
 
 		it('should generate x_google_ignoreList correctly', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			const one = new MagicString('function one () {}', { filename: 'one.js' });
 			const two = new MagicString('function two () {}', { filename: 'two.js' });
@@ -377,17 +374,17 @@
 			b.addSource({ content: four });
 
 			const map = b.generateMap({
-				file: 'output.js',
+				file: 'output.js'
 			});
 
 			assert.deepEqual(map.x_google_ignoreList, [
 				map.sources.indexOf('two.js'),
-				map.sources.indexOf('three.js'),
+				map.sources.indexOf('three.js')
 			]);
 		});
 
 		it('handles prepended content', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			const one = new MagicString('function one () {}', { filename: 'one.js' });
 			const two = new MagicString('function two () {}', { filename: 'two.js' });
@@ -399,7 +396,7 @@
 			const map = b.generateMap({
 				file: 'output.js',
 				source: 'input.js',
-				includeContent: true,
+				includeContent: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -413,7 +410,7 @@
 		});
 
 		it('handles appended content', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			const one = new MagicString('function one () {}', { filename: 'one.js' });
 			one.append('\nfunction oneAndAHalf() {}');
@@ -425,7 +422,7 @@
 			const map = b.generateMap({
 				file: 'output.js',
 				source: 'input.js',
-				includeContent: true,
+				includeContent: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -439,12 +436,12 @@
 		});
 
 		it('should handle empty separator', () => {
-			const b = new Bundle({
-				separator: '',
+			const b = new MagicString.Bundle({
+				separator: ''
 			});
 
 			b.addSource({
-				content: new MagicString('if ( foo ) { '),
+				content: new MagicString('if ( foo ) { ')
 			});
 
 			const s = new MagicString('console.log( 42 );');
@@ -453,11 +450,11 @@
 
 			b.addSource({
 				filename: 'input.js',
-				content: s,
+				content: s
 			});
 
 			b.addSource({
-				content: new MagicString(' }'),
+				content: new MagicString(' }')
 			});
 
 			assert.equal(b.toString(), 'if ( foo ) { console.log( 42 ); }');
@@ -465,7 +462,7 @@
 			const map = b.generateMap({
 				file: 'output.js',
 				source: 'input.js',
-				includeContent: true,
+				includeContent: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -475,18 +472,17 @@
 				source: 'input.js',
 				name: null,
 				line: 1,
-				column: 8,
+				column: 8
 			});
 		});
 
 		// TODO tidy this up. is a recreation of a bug in Svelte
 		it('generates a correct sourcemap for a Svelte component', () => {
-			const b = new Bundle({
-				separator: '',
+			const b = new MagicString.Bundle({
+				separator: ''
 			});
 
-			const s = new MagicString(
-				`
+			const s = new MagicString(`
 <div></div>
 
 <script>
@@ -495,10 +491,9 @@
 			console.log( 42 );
 		}
 	}
-</script>`.trim(),
-			);
+</script>`.trim());
 
-			[21, 23, 38, 42, 50, 51, 54, 59, 66, 67, 70, 72, 74, 76, 77, 81, 84, 85].forEach((pos) => {
+			[21, 23, 38, 42, 50, 51, 54, 59, 66, 67, 70, 72, 74, 76, 77, 81, 84, 85].forEach(pos => {
 				s.addSourcemapLocation(pos);
 			});
 
@@ -510,25 +505,22 @@
 
 			b.addSource({
 				content: s,
-				filename: 'input.js',
+				filename: 'input.js'
 			});
 
-			assert.equal(
-				b.toString(),
-				`
+			assert.equal(b.toString(), `
 var template = (function () {
 	return {
 		onrender () {
 			console.log( 42 );
 		}
 	}
-}());`.trim(),
-			);
+}());`.trim());
 
 			const map = b.generateMap({
 				file: 'output.js',
 				source: 'input.js',
-				includeContent: true,
+				includeContent: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -538,14 +530,14 @@
 				source: 'input.js',
 				name: null,
 				line: 6,
-				column: 16,
+				column: 16
 			});
 		});
 	});
 
 	describe('indent', () => {
 		it('should indent a bundle', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource({ content: new MagicString('abcdef') });
 			b.addSource({ content: new MagicString('ghijkl') });
@@ -555,7 +547,7 @@
 		});
 
 		it('should ignore non-indented sources when guessing indentation', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource({ content: new MagicString('abcdef') });
 			b.addSource({ content: new MagicString('ghijkl') });
@@ -566,11 +558,11 @@
 		});
 
 		it('should respect indent exclusion ranges', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource({
 				content: new MagicString('abc\ndef\nghi\njkl'),
-				indentExclusionRanges: [7, 15],
+				indentExclusionRanges: [7, 15]
 			});
 
 			b.indent('  ');
@@ -581,7 +573,7 @@
 		});
 
 		it('does not indent sources with no preceding newline, i.e. append()', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource(new MagicString('abcdef'));
 			b.addSource(new MagicString('ghijkl'));
@@ -591,7 +583,7 @@
 		});
 
 		it('should noop with an empty string', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource(new MagicString('abcdef'));
 			b.addSource(new MagicString('ghijkl'));
@@ -601,14 +593,14 @@
 		});
 
 		it('indents prepended content', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 			b.prepend('a\nb').indent();
 
 			assert.equal(b.toString(), '\ta\n\tb');
 		});
 
 		it('indents content immediately following intro with trailing newline', () => {
-			const b = new Bundle({ separator: '\n\n' });
+			const b = new MagicString.Bundle({ separator: '\n\n' });
 
 			const s = new MagicString('2');
 			b.addSource({ content: s });
@@ -619,19 +611,19 @@
 		});
 
 		it('should return this', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 			assert.strictEqual(b.indent(), b);
 		});
 
 		it('should return this on noop', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 			assert.strictEqual(b.indent(''), b);
 		});
 	});
 
 	describe('prepend', () => {
 		it('should append content', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource({ content: new MagicString('*') });
 
@@ -640,21 +632,21 @@
 		});
 
 		it('should return this', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 			assert.strictEqual(b.prepend('x'), b);
 		});
 	});
 
 	describe('trim', () => {
 		it('should trim bundle', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource({
-				content: new MagicString('   abcdef   '),
+				content: new MagicString('   abcdef   ')
 			});
 
 			b.addSource({
-				content: new MagicString('   ghijkl   '),
+				content: new MagicString('   ghijkl   ')
 			});
 
 			b.trim();
@@ -662,14 +654,14 @@
 		});
 
 		it('should handle funky edge cases', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource({
-				content: new MagicString('   abcdef   '),
+				content: new MagicString('   abcdef   ')
 			});
 
 			b.addSource({
-				content: new MagicString('   x   '),
+				content: new MagicString('   x   ')
 			});
 
 			b.prepend('\n>>>\n').append('   ');
@@ -679,14 +671,14 @@
 		});
 
 		it('should return this', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 			assert.strictEqual(b.trim(), b);
 		});
 	});
 
 	describe('toString', () => {
 		it('should separate with a newline by default', () => {
-			const b = new Bundle();
+			const b = new MagicString.Bundle();
 
 			b.addSource(new MagicString('abc'));
 			b.addSource(new MagicString('def'));
@@ -695,7 +687,7 @@
 		});
 
 		it('should accept separator option', () => {
-			const b = new Bundle({ separator: '==' });
+			const b = new MagicString.Bundle({ separator: '==' });
 
 			b.addSource(new MagicString('abc'));
 			b.addSource(new MagicString('def'));
@@ -704,7 +696,7 @@
 		});
 
 		it('should accept empty string separator option', () => {
-			const b = new Bundle({ separator: '' });
+			const b = new MagicString.Bundle({ separator: '' });
 
 			b.addSource(new MagicString('abc'));
 			b.addSource(new MagicString('def'));
@@ -721,17 +713,17 @@
 			const s2 = 'VWXYZ';
 			const ms2 = new MagicString(s2, { filename: 'second' });
 
-			const bundle = new Bundle();
+			const bundle = new MagicString.Bundle();
 			bundle.addSource(ms1);
 			bundle.addSource(ms2);
 
-			ms1.remove(2, 4); // ABE
+			ms1.remove(2,4);   // ABE
 			ms1.move(0, 1, 5); // BEA
 
-			ms2.remove(2, 4); // VWZ
+			ms2.remove(2,4);   // VWZ
 			ms2.move(0, 1, 5); // WZV
 
-			const map = bundle.generateMap({ file: 'result', hires: true, includeContent: true });
+			const map = bundle.generateMap({file: 'result', hires: true, includeContent: true});
 			const smc = new SourceMapConsumer(map);
 
 			const result1 = ms1.toString();
@@ -760,10 +752,7 @@
 				assert.strictEqual(s2[loc.column], result2[i]);
 			}
 
-			assert.strictEqual(
-				map.toString(),
-				'{"version":3,"file":"result","sources":["first","second"],"sourcesContent":["ABCDE","VWXYZ"],"names":[],"mappings":"AAAC,CAAG,CAAJ;ACAC,CAAG,CAAJ"}',
-			);
+			assert.strictEqual(map.toString(), '{"version":3,"file":"result","sources":["first","second"],"sourcesContent":["ABCDE","VWXYZ"],"names":[],"mappings":"AAAC,CAAG,CAAJ;ACAC,CAAG,CAAJ"}');
 		});
 	});
 });
--- a/test/MagicString.test.js
+++ b/test/MagicString.test.js
@@ -1,13 +1,14 @@
-import assert from 'assert';
-import { SourceMapConsumer } from 'source-map-js';
-import MagicString from './utils/IntegrityCheckingMagicString';
-import { describe, it } from 'vitest';
+const assert = require('assert');
+const SourceMapConsumer = require('source-map-js').SourceMapConsumer;
+const MagicString = require('./utils/IntegrityCheckingMagicString');
+
+require('source-map-support').install();
 
 describe('MagicString', () => {
 	describe('options', () => {
 		it('stores source file information', () => {
 			const s = new MagicString('abc', {
-				filename: 'foo.js',
+				filename: 'foo.js'
 			});
 
 			assert.equal(s.filename, 'foo.js');
@@ -98,26 +99,6 @@
 
 			assert.equal(s.toString(), 'x4213');
 		});
-
-		it('should append/prepend at end of string when index is out of upper bound', () => {
-			const s = new MagicString('x');
-			s.prependLeft(6, 'A');
-			s.appendLeft(6, 'B');
-			s.prependRight(6, 'C');
-			s.appendRight(6, 'D');
-
-			assert.equal(s.toString(), 'ABxCD');
-		});
-
-		it('should append/prepend on empty string when index is out of upper bound', () => {
-			const s = new MagicString('');
-			s.prependLeft(6, 'A');
-			s.appendLeft(6, 'B');
-			s.prependRight(6, 'C');
-			s.appendRight(6, 'D');
-
-			assert.equal(s.toString(), 'ABCD');
-		});
 	});
 
 	describe('appendLeft', () => {
@@ -156,7 +137,7 @@
 			const array = [3, 6];
 			const source = new MagicString('abcdefghijkl', {
 				filename: 'foo.js',
-				indentExclusionRanges: array,
+				indentExclusionRanges: array
 			});
 
 			const clone = source.clone();
@@ -166,13 +147,10 @@
 		});
 
 		it('should clone complex indentExclusionRanges', () => {
-			const array = [
-				[3, 6],
-				[7, 9],
-			];
+			const array = [[3, 6], [7, 9]];
 			const source = new MagicString('abcdefghijkl', {
 				filename: 'foo.js',
-				indentExclusionRanges: array,
+				indentExclusionRanges: array
 			});
 
 			const clone = source.clone();
@@ -183,7 +161,7 @@
 
 		it('should clone sourcemapLocations', () => {
 			const source = new MagicString('abcdefghijkl', {
-				filename: 'foo.js',
+				filename: 'foo.js'
 			});
 
 			source.addSourcemapLocation(3);
@@ -214,7 +192,7 @@
 				file: 'output.md',
 				source: 'input.md',
 				includeContent: true,
-				hires: true,
+				hires: true
 			});
 
 			assert.equal(map.version, 3);
@@ -223,14 +201,8 @@
 			assert.deepEqual(map.sourcesContent, ['abcdefghijkl']);
 			assert.equal(map.mappings, 'AAAA,CAAC,CAAC,CAAO,CAAC,CAAC');
 
-			assert.equal(
-				map.toString(),
-				'{"version":3,"file":"output.md","sources":["input.md"],"sourcesContent":["abcdefghijkl"],"names":[],"mappings":"AAAA,CAAC,CAAC,CAAO,CAAC,CAAC"}',
-			);
-			assert.equal(
-				map.toUrl(),
-				'data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0cHV0Lm1kIiwic291cmNlcyI6WyJpbnB1dC5tZCJdLCJzb3VyY2VzQ29udGVudCI6WyJhYmNkZWZnaGlqa2wiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsQ0FBQyxDQUFDLENBQU8sQ0FBQyxDQUFDIn0=',
-			);
+			assert.equal(map.toString(), '{"version":3,"file":"output.md","sources":["input.md"],"sourcesContent":["abcdefghijkl"],"names":[],"mappings":"AAAA,CAAC,CAAC,CAAO,CAAC,CAAC"}');
+			assert.equal(map.toUrl(), 'data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0cHV0Lm1kIiwic291cmNlcyI6WyJpbnB1dC5tZCJdLCJzb3VyY2VzQ29udGVudCI6WyJhYmNkZWZnaGlqa2wiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsQ0FBQyxDQUFDLENBQU8sQ0FBQyxDQUFDIn0=');
 
 			const smc = new SourceMapConsumer(map);
 			let loc;
@@ -257,19 +229,19 @@
 				includeContent: true,
 			});
 
-			assert.equal(map.mappings, ';AAAA;AACA');
+			assert.equal(map.mappings,';AAAA;AACA');
 		});
 
 		it('should generate a correct sourcemap for indented content', () => {
 			const s = new MagicString('var answer = 42;\nconsole.log("the answer is %s", answer);');
 
-			s.prepend("'use strict';\n\n");
+			s.prepend('\'use strict\';\n\n');
 			s.indent('\t').prepend('(function () {\n').append('\n}).call(global);');
 
 			const map = s.generateMap({
 				source: 'input.md',
 				includeContent: true,
-				hires: true,
+				hires: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -290,7 +262,7 @@
 			const map = s.generateMap({
 				file: 'output.md',
 				source: 'input.md',
-				includeContent: true,
+				includeContent: true
 			});
 
 			assert.equal(map.version, 3);
@@ -298,14 +270,8 @@
 			assert.deepEqual(map.sources, ['input.md']);
 			assert.deepEqual(map.sourcesContent, ['abcdefghijkl']);
 
-			assert.equal(
-				map.toString(),
-				'{"version":3,"file":"output.md","sources":["input.md"],"sourcesContent":["abcdefghijkl"],"names":[],"mappings":"AAAA,GAAG,GAAM,CAAC"}',
-			);
-			assert.equal(
-				map.toUrl(),
-				'data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0cHV0Lm1kIiwic291cmNlcyI6WyJpbnB1dC5tZCJdLCJzb3VyY2VzQ29udGVudCI6WyJhYmNkZWZnaGlqa2wiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsR0FBRyxHQUFNLENBQUMifQ==',
-			);
+			assert.equal(map.toString(), '{"version":3,"file":"output.md","sources":["input.md"],"sourcesContent":["abcdefghijkl"],"names":[],"mappings":"AAAA,GAAG,GAAM,CAAC"}');
+			assert.equal(map.toUrl(), 'data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0cHV0Lm1kIiwic291cmNlcyI6WyJpbnB1dC5tZCJdLCJzb3VyY2VzQ29udGVudCI6WyJhYmNkZWZnaGlqa2wiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsR0FBRyxHQUFNLENBQUMifQ==');
 
 			const smc = new SourceMapConsumer(map);
 			let loc;
@@ -331,7 +297,7 @@
 			const map = s.generateMap({
 				file: 'output.js',
 				source: 'input.js',
-				includeContent: true,
+				includeContent: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -362,7 +328,7 @@
 			const map = s.generateMap({
 				file: 'output.js',
 				source: 'input.js',
-				includeContent: true,
+				includeContent: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -378,13 +344,13 @@
 			const map = s.generateMap({
 				file: 'output.js',
 				source: 'input.js',
-				includeContent: true,
+				includeContent: true
 			});
 
 			const smc = new SourceMapConsumer(map);
 
 			let numMappings = 0;
-			smc.eachMapping(() => (numMappings += 1));
+			smc.eachMapping(() => numMappings += 1);
 
 			assert.equal(numMappings, 3); // one at 0, one at the edit, one afterwards
 		});
@@ -398,7 +364,7 @@
 				file: 'output.js',
 				source: 'input.js',
 				includeContent: true,
-				hires: true,
+				hires: true
 			});
 
 			const smc = new SourceMapConsumer(map);
@@ -418,7 +384,7 @@
 				file: 'output',
 				source: 'input',
 				includeContent: true,
-				hires: true,
+				hires: true
 			});
 
 			const smc1 = new SourceMapConsumer(map1);
@@ -431,7 +397,7 @@
 				file: 'output',
 				source: 'input',
 				includeContent: true,
-				hires: true,
+				hires: true
 			});
 
 			const smc2 = new SourceMapConsumer(map2);
@@ -461,8 +427,8 @@
 
 		it('generates x_google_ignoreList', () => {
 			const s = new MagicString('function foo(){}', {
-				ignoreList: true,
-			});
+				ignoreList: true
+		  });
 
 			const map = s.generateMap({ source: 'foo.js' });
 			assert.deepEqual(map.sources, ['foo.js']);
@@ -479,13 +445,10 @@
 				file: 'output.js',
 				source: 'input.js',
 				includeContent: true,
-				hires: 'boundary',
+				hires: 'boundary'
 			});
 
-			assert.equal(
-				map.mappings,
-				'AAAA,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAG,CAAC,CAAC,CAAC',
-			);
+			assert.equal(map.mappings, 'AAAA,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAG,CAAC,CAAC,CAAC');
 
 			const smc = new SourceMapConsumer(map);
 			let loc;
@@ -507,33 +470,6 @@
 			assert.equal(loc.column, 33);
 		});
 
-		it('generates segments per word boundary with hires "boundary" in the next line', () => {
-			const s = new MagicString('// foo\nconsole.log("bar")');
-
-			// rename bar to hello
-			s.overwrite(20, 23, 'hello');
-
-			const map = s.generateMap({
-				file: 'output.js',
-				source: 'input.js',
-				includeContent: true,
-				hires: 'boundary',
-			});
-
-			assert.equal(map.mappings, 'AAAA,CAAC,CAAC,CAAC;AACH,OAAO,CAAC,GAAG,CAAC,CAAC,KAAG,CAAC');
-
-			const smc = new SourceMapConsumer(map);
-			let loc;
-
-			loc = smc.originalPositionFor({ line: 2, column: 2 });
-			assert.equal(loc.line, 2);
-			assert.equal(loc.column, 0);
-
-			loc = smc.originalPositionFor({ line: 2, column: 12 });
-			assert.equal(loc.line, 2);
-			assert.equal(loc.column, 12);
-		});
-
 		it('generates a correct source map with update using a content containing a new line', () => {
 			const s = new MagicString('foobar');
 			s.update(3, 4, '\nbb');
@@ -592,22 +528,6 @@
 			assert.equal(loc8.line, 1);
 			assert.equal(loc8.column, 5);
 		});
-
-		it('generates a source map without unneeded line break mappings', () => {
-			const s = new MagicString('function foo(){\n  console.log("bar")\n}');
-
-			const map = s.generateMap({
-				file: 'output.js',
-				source: 'input.js',
-				includeContent: true,
-				hires: 'boundary',
-			});
-
-			assert.equal(
-				map.mappings,
-				'AAAA,QAAQ,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;AACnB',
-			);
-		});
 	});
 
 	describe('getIndentString', () => {
@@ -924,10 +844,7 @@
 
 			s.overwrite(7, 11, 'xx');
 
-			assert.throws(
-				() => s.overwrite(8, 12, 'yy'),
-				/Cannot split a chunk that has already been edited/,
-			);
+			assert.throws(() => s.overwrite(8, 12, 'yy'), /Cannot split a chunk that has already been edited/);
 
 			assert.equal(s.toString(), 'abcdefgxxl');
 
@@ -987,10 +904,7 @@
 
 		it('should disallow overwriting zero-length ranges', () => {
 			const s = new MagicString('x');
-			assert.throws(
-				() => s.overwrite(0, 0, 'anything'),
-				/Cannot overwrite a zero-length range – use appendLeft or prependRight instead/,
-			);
+			assert.throws(() => s.overwrite(0, 0, 'anything'), /Cannot overwrite a zero-length range – use appendLeft or prependRight instead/);
 		});
 
 		it('should throw when given non-string content', () => {
@@ -1065,10 +979,7 @@
 
 			s.update(7, 11, 'xx');
 
-			assert.throws(
-				() => s.update(8, 12, 'yy'),
-				/Cannot split a chunk that has already been edited/,
-			);
+			assert.throws(() => s.update(8, 12, 'yy'), /Cannot split a chunk that has already been edited/);
 
 			assert.equal(s.toString(), 'abcdefgxxl');
 
@@ -1128,10 +1039,7 @@
 
 		it('should disallow updating zero-length ranges', () => {
 			const s = new MagicString('x');
-			assert.throws(
-				() => s.update(0, 0, 'anything'),
-				/Cannot overwrite a zero-length range – use appendLeft or prependRight instead/,
-			);
+			assert.throws(() => s.update(0, 0, 'anything'), /Cannot overwrite a zero-length range – use appendLeft or prependRight instead/);
 		});
 
 		it('should throw when given non-string content', () => {
@@ -1326,19 +1234,6 @@
 
 			assert.equal(s.toString(), 'abchidejkl');
 		});
-
-		it('should accept negative indices', () => {
-			const s = new MagicString('abcde');
-			// "abcde"
-			//     ^
-			s.remove(-2, -1);
-			assert.equal(s.toString(), 'abce');
-		});
-
-		it('should throw error when using negative indices with empty string', () => {
-			const s = new MagicString('');
-			assert.throws(() => s.remove(-2, -1), /Error: Character is out of bounds/);
-		});
 	});
 
 	describe('reset', () => {
@@ -1580,7 +1475,7 @@
 	describe('snip', () => {
 		it('should return a clone with content outside `start` and `end` removed', () => {
 			const s = new MagicString('abcdefghijkl', {
-				filename: 'foo.js',
+				filename: 'foo.js'
 			});
 
 			s.overwrite(6, 9, 'GHI');
@@ -1805,15 +1700,24 @@
 		});
 
 		it('Should not treat string as regexp', () => {
-			assert.strictEqual(new MagicString('1234').replace('.', '*').toString(), '1234');
+			assert.strictEqual(
+				new MagicString('1234').replace('.', '*').toString(),
+				'1234'
+			);
 		});
 
 		it('Should use substitution directly', () => {
-			assert.strictEqual(new MagicString('11').replace('1', '$0$1').toString(), '$0$11');
+			assert.strictEqual(
+				new MagicString('11').replace('1', '$0$1').toString(),
+				'$0$11'
+			);
 		});
 
 		it('Should not search back', () => {
-			assert.strictEqual(new MagicString('122121').replace('12', '21').toString(), '212121');
+			assert.strictEqual(
+				new MagicString('122121').replace('12', '21').toString(),
+				'212121'
+			);
 		});
 
 		it('works with global regex replace', () => {
@@ -1829,7 +1733,7 @@
 
 			s.replace(/(\d)/g, '$$');
 
-			assert.strictEqual(s.toString(), '$ $ $ $ a b c');
+			assert.strictEqual(s.toString(),'$ $ $ $ a b c');
 		});
 
 		it('works with global regex replace function', () => {
@@ -1838,7 +1742,7 @@
 
 			s.replace(/(\w)(\w+)/g, (_, $1, $2) => `${$1.toUpperCase()}${$2}`);
 
-			assert.strictEqual(s.toString(), 'Hey This Is Magic');
+			assert.strictEqual(s.toString(),'Hey This Is Magic');
 		});
 
 		it('replace function offset', () => {
@@ -1851,7 +1755,7 @@
 			const regex = /([^\d]*)(\d*)([^\w]*)/;
 			assert.strictEqual(
 				code.replace(regex, replacer),
-				new MagicString(code).replace(regex, replacer).toString(),
+				new MagicString(code).replace(regex, replacer).toString()
 			);
 		});
 
@@ -1877,19 +1781,31 @@
 
 	describe('replaceAll', () => {
 		it('works with string replace', () => {
-			assert.strictEqual(new MagicString('1212').replaceAll('2', '3').toString(), '1313');
+			assert.strictEqual(
+				new MagicString('1212').replaceAll('2', '3').toString(),
+				'1313',
+			);
 		});
 
 		it('Should not treat string as regexp', () => {
-			assert.strictEqual(new MagicString('1234').replaceAll('.', '*').toString(), '1234');
+			assert.strictEqual(
+				new MagicString('1234').replaceAll('.', '*').toString(),
+				'1234'
+			);
 		});
 
 		it('Should use substitution directly', () => {
-			assert.strictEqual(new MagicString('11').replaceAll('1', '$0$1').toString(), '$0$1$0$1');
+			assert.strictEqual(
+				new MagicString('11').replaceAll('1', '$0$1').toString(),
+				'$0$1$0$1'
+			);
 		});
 
 		it('Should not search back', () => {
-			assert.strictEqual(new MagicString('121212').replaceAll('12', '21').toString(), '212121');
+			assert.strictEqual(
+				new MagicString('121212').replaceAll('12', '21').toString(),
+				'212121'
+			);
 		});
 
 		it('global regex result the same as .replace', () => {
@@ -1904,38 +1820,19 @@
 			);
 
 			assert.strictEqual(
-				new MagicString('hey this is magic')
-					.replaceAll(/(\w)(\w+)/g, (_, $1, $2) => `${$1.toUpperCase()}${$2}`)
-					.toString(),
-				new MagicString('hey this is magic')
-					.replace(/(\w)(\w+)/g, (_, $1, $2) => `${$1.toUpperCase()}${$2}`)
-					.toString(),
+				new MagicString('hey this is magic').replaceAll(/(\w)(\w+)/g, (_, $1, $2) => `${$1.toUpperCase()}${$2}`).toString(),
+				new MagicString('hey this is magic').replace(/(\w)(\w+)/g, (_, $1, $2) => `${$1.toUpperCase()}${$2}`).toString(),
 			);
 		});
 
 		it('rejects with non-global regexp', () => {
-			assert.throws(() => new MagicString('123').replaceAll(/./, ''), {
-				name: 'TypeError',
-				message: 'MagicString.prototype.replaceAll called with a non-global RegExp argument',
-			});
-		});
-
-		it('with offset', () => {
-			const s = new MagicString('hello world', { offset: 6 });
-			assert.equal(s.slice(0, 5), 'world');
-			assert.equal(s.remove(0, 5).toString(), 'hello ');
-			assert.equal(s.prependLeft(0, 'w').toString(), 'hello w');
-			assert.equal(s.appendLeft(0, 'o').toString(), 'hello wo');
-			assert.equal(s.prependRight(0, 'r').toString(), 'hello wor');
-			assert.equal(s.appendRight(0, 'l').toString(), 'hello worl');
-			assert.equal(s.reset(4, 5).toString(), 'hello world');
-			assert.equal(s.update(0, 5, 'd').toString(), 'hello world');
-			assert.equal(s.overwrite(0, 5, 'rld').toString(), 'hello world');
-
-			s.offset = 1;
-			const s1 = s.clone();
-			assert.strictEqual(s1.slice(), 'ello world');
-			assert.equal(s1.move(0, 1, 2).slice(0), 'elo world');
+			assert.throws(
+				() => new MagicString('123').replaceAll(/./, ''),
+				{
+					name: 'TypeError',
+					message: 'MagicString.prototype.replaceAll called with a non-global RegExp argument',
+				},
+			);
 		});
 	});
 });
--- a/test/SourceMap.test.js
+++ b/test/SourceMap.test.js
@@ -1,17 +1,18 @@
-import { describe, it } from 'vitest';
-import assert from 'assert';
-import { SourceMap } from '../';
+const assert = require('assert');
+const MagicString = require('../');
+
+require('source-map-support').install();
 
 describe('MagicString.SourceMap', () => {
 	describe('options', () => {
 		it('preserves ignore list information', () => {
-			const map = new SourceMap({
+			const map = new MagicString.SourceMap({
 				file: 'foo.min.js',
 				sources: ['foo.js'],
 				sourcesContent: ['42'],
 				names: [],
 				mappings: [[0, 0]],
-				x_google_ignoreList: [0],
+				x_google_ignoreList: [0]
 			});
 
 			assert.deepEqual(map.x_google_ignoreList, [0]);
@@ -20,19 +21,16 @@
 
 	describe('toString', () => {
 		it('serializes ignore list information', () => {
-			const map = new SourceMap({
+			const map = new MagicString.SourceMap({
 				file: 'foo.min.js',
 				sources: ['foo.js'],
 				sourcesContent: ['42'],
 				names: [],
 				mappings: [[0, 0]],
-				x_google_ignoreList: [0],
+				x_google_ignoreList: [0]
 			});
 
-			assert.equal(
-				map.toString(),
-				'{"version":3,"file":"foo.min.js","sources":["foo.js"],"sourcesContent":["42"],"names":[],"mappings":"AAAAA,AAAAA","x_google_ignoreList":[0]}',
-			);
+			assert.equal(map.toString(), '{"version":3,"file":"foo.min.js","sources":["foo.js"],"sourcesContent":["42"],"names":[],"mappings":"AAAAA,AAAAA","x_google_ignoreList":[0]}');
 		});
 	});
 });
--- a/test/utils/IntegrityCheckingMagicString.js
+++ b/test/utils/IntegrityCheckingMagicString.js
@@ -1,5 +1,5 @@
-import MagicString from '../../src';
-import { assert } from 'vitest';
+const MagicString = require('../../');
+const assert = require('assert');
 
 class IntegrityCheckingMagicString extends MagicString {
 	checkIntegrity() {
@@ -44,4 +44,4 @@
 	}
 }
 
-export default IntegrityCheckingMagicString;
+module.exports = IntegrityCheckingMagicString;
