update tests

pull/10464/head
Rich Harris 3 years ago
parent cd972d9779
commit f4f3d3a830

@ -73,7 +73,7 @@ export async function compile_directory(
let text = fs.readFileSync(`${cwd}/${file}`, 'utf-8');
let opts = {
filename: path.join(cwd, file),
filename: file,
...compileOptions,
generate
};
@ -117,8 +117,8 @@ export async function compile_directory(
}
const compiled = compile(text, {
outputFilename: `${output_dir}/${file}${file.endsWith('.js') ? '' : '.js'}`,
cssOutputFilename: `${output_dir}/${file}.css`,
outputFilename: `${file}${file.endsWith('.js') ? '' : '.js'}`,
cssOutputFilename: `${file}.css`,
...opts
});
compiled.js.code = compiled.js.code.replace(`v${VERSION}`, 'VERSION');

@ -41,7 +41,7 @@ export default test({
assert.htmlEqual(target.innerHTML, `<button>clicks: 1</button>`);
assert.deepEqual(warnings, [
'Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use callback instead.'
'Counter.svelte mutated a value owned by main.svelte. This is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead.'
]);
}
});

@ -3,7 +3,7 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
export default function Bind_this($$anchor, $$props) {
export default function Index($$anchor, $$props) {
$.push($$props, false);
$.init();

@ -2,7 +2,7 @@
// Note: compiler output will change before 5.0 is released!
import * as $ from "svelte/internal/server";
export default function Bind_this($$payload, $$props) {
export default function Index($$payload, $$props) {
$.push(false);
const anchor = $.create_anchor($$payload);

@ -3,7 +3,7 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
export default function Class_state_field_constructor_assignment($$anchor, $$props) {
export default function Index($$anchor, $$props) {
$.push($$props, true);
class Foo {

@ -2,7 +2,7 @@
// Note: compiler output will change before 5.0 is released!
import * as $ from "svelte/internal/server";
export default function Class_state_field_constructor_assignment($$payload, $$props) {
export default function Index($$payload, $$props) {
$.push(true);
class Foo {

@ -3,7 +3,7 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
export default function Each_string_template($$anchor, $$props) {
export default function Index($$anchor, $$props) {
$.push($$props, false);
$.init();

@ -2,7 +2,7 @@
// Note: compiler output will change before 5.0 is released!
import * as $ from "svelte/internal/server";
export default function Each_string_template($$payload, $$props) {
export default function Index($$payload, $$props) {
$.push(false);
const anchor = $.create_anchor($$payload);

@ -3,7 +3,7 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
export default function Function_prop_no_getter($$anchor, $$props) {
export default function Index($$anchor, $$props) {
$.push($$props, true);
let count = $.source(0);

@ -2,7 +2,7 @@
// Note: compiler output will change before 5.0 is released!
import * as $ from "svelte/internal/server";
export default function Function_prop_no_getter($$payload, $$props) {
export default function Index($$payload, $$props) {
$.push(true);
let count = 0;

@ -5,7 +5,7 @@ import * as $ from "svelte/internal";
var frag = $.template(`<h1>hello world</h1>`);
export default function Hello_world($$anchor, $$props) {
export default function Index($$anchor, $$props) {
$.push($$props, false);
$.init();

@ -2,7 +2,7 @@
// Note: compiler output will change before 5.0 is released!
import * as $ from "svelte/internal/server";
export default function Hello_world($$payload, $$props) {
export default function Index($$payload, $$props) {
$.push(false);
$$payload.out += `<h1>hello world</h1>`;
$.pop();

@ -12,7 +12,7 @@ function reset(_, str, tpl) {
var frag = $.template(`<input> <input> <button>reset</button>`, true);
export default function State_proxy_literal($$anchor, $$props) {
export default function Index($$anchor, $$props) {
$.push($$props, true);
let str = $.source('');

@ -2,7 +2,7 @@
// Note: compiler output will change before 5.0 is released!
import * as $ from "svelte/internal/server";
export default function State_proxy_literal($$payload, $$props) {
export default function Index($$payload, $$props) {
$.push(true);
let str = '';

@ -3,7 +3,7 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
export default function Svelte_element($$anchor, $$props) {
export default function Index($$anchor, $$props) {
$.push($$props, true);
let tag = $.prop($$props, "tag", 3, 'hr');

@ -2,7 +2,7 @@
// Note: compiler output will change before 5.0 is released!
import * as $ from "svelte/internal/server";
export default function Svelte_element($$payload, $$props) {
export default function Index($$payload, $$props) {
$.push(true);
let { tag = 'hr' } = $$props;

@ -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,13 +38,7 @@ 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