undo change to sourcemap tests

pull/10464/head
Rich Harris 3 years ago
parent fc40b79494
commit adf542a8e2

@ -117,8 +117,8 @@ export async function compile_directory(
}
const compiled = compile(text, {
outputFilename: `${file}${file.endsWith('.js') ? '' : '.js'}`,
cssOutputFilename: `${file}.css`,
outputFilename: `_output/${generate}/${file}${file.endsWith('.js') ? '' : '.js'}`,
cssOutputFilename: `_output/${generate}/${file}.css`,
...opts
});
compiled.js.code = compiled.js.code.replace(`v${VERSION}`, 'VERSION');

@ -42,7 +42,7 @@ export default test({
const css_map_json = Buffer.from(css_map_base64, 'base64').toString();
const map = new TraceMap(css_map_json);
const sourcefile = 'input.svelte';
const sourcefile = '../../input.svelte';
const locate = getLocator(
css.replace(/\\r/g, '\r').replace(/\\n/g, '\n').replace(/\\t/g, '\t'),
{ offsetLine: 1 }

@ -38,7 +38,13 @@ const FOO2 = 'var answer2 = 84; // foo2.js\n';
const BAR2 = 'console.log(answer2); // bar2.js\n';
export default test({
js_map_sources: ['input.svelte', 'foo.js', 'bar.js', 'foo2.js', 'bar2.js'],
js_map_sources: [
'../../input.svelte',
'../../foo.js',
'../../bar.js',
'../../foo2.js',
'../../bar2.js'
],
preprocess: [
{
script: ({ content, filename = '' }) => {

@ -2,7 +2,7 @@ import { test } from '../../test';
export default test({
test({ assert, map_client }) {
assert.deepEqual(map_client.sources, ['input.svelte']);
assert.deepEqual(map_client.sources, ['../../input.svelte']);
// TODO do we need to set sourcesContent? We did it in Svelte 4, but why?
// assert.deepEqual(js.map.sourcesContent, [
// fs.readFileSync(path.join(__dirname, 'input.svelte'), 'utf-8')

@ -198,7 +198,7 @@ const { test, run } = suite<SourcemapTest>(async (config, cwd) => {
map_client = JSON.parse(fs.readFileSync(`${cwd}/_output/client/input.svelte.js.map`, 'utf-8'));
assert.deepEqual(
map_client.sources.slice().sort(),
(config.js_map_sources || ['input.svelte']).sort(),
(config.js_map_sources || ['../../input.svelte']).sort(),
'js.map.sources is wrong'
);
@ -238,7 +238,7 @@ const { test, run } = suite<SourcemapTest>(async (config, cwd) => {
map_css = JSON.parse(fs.readFileSync(`${cwd}/_output/client/input.svelte.css.map`, 'utf-8'));
assert.deepEqual(
map_css.sources.slice().sort(),
(config.css_map_sources || ['input.svelte']).sort(),
(config.css_map_sources || ['../../input.svelte']).sort(),
'css.map.sources is wrong'
);
compare('css', code_css, map_css, config.css);

Loading…
Cancel
Save