|
|
@ -98,12 +98,12 @@ describe("formats", () => {
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const { code } = svelte.compile(source, {
|
|
|
|
const { js } = svelte.compile(source, {
|
|
|
|
format: "amd",
|
|
|
|
format: "amd",
|
|
|
|
amd: { id: "foo" }
|
|
|
|
amd: { id: "foo" }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return testAmd(code, "foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
return testAmd(js.code, "foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -123,11 +123,11 @@ describe("formats", () => {
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const { code } = svelte.compile(source, {
|
|
|
|
const { js } = svelte.compile(source, {
|
|
|
|
format: "cjs"
|
|
|
|
format: "cjs"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return testCjs(code, { answer: 42 }, `<div>42</div>`);
|
|
|
|
return testCjs(js.code, { answer: 42 }, `<div>42</div>`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -147,7 +147,7 @@ describe("formats", () => {
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const { code } = svelte.compile(source, {
|
|
|
|
const { js } = svelte.compile(source, {
|
|
|
|
format: "iife",
|
|
|
|
format: "iife",
|
|
|
|
name: "Foo",
|
|
|
|
name: "Foo",
|
|
|
|
globals: {
|
|
|
|
globals: {
|
|
|
@ -155,7 +155,7 @@ describe("formats", () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return testIife(code, "Foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
return testIife(js.code, "Foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('requires options.name', () => {
|
|
|
|
it('requires options.name', () => {
|
|
|
@ -221,7 +221,7 @@ describe("formats", () => {
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const { code } = svelte.compile(source, {
|
|
|
|
const { js } = svelte.compile(source, {
|
|
|
|
format: "umd",
|
|
|
|
format: "umd",
|
|
|
|
name: "Foo",
|
|
|
|
name: "Foo",
|
|
|
|
globals: {
|
|
|
|
globals: {
|
|
|
@ -232,9 +232,9 @@ describe("formats", () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
testAmd(code, "foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
testAmd(js.code, "foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
testCjs(code, { answer: 42 }, `<div>42</div>`);
|
|
|
|
testCjs(js.code, { answer: 42 }, `<div>42</div>`);
|
|
|
|
testIife(code, "Foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
testIife(js.code, "Foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('requires options.name', () => {
|
|
|
|
it('requires options.name', () => {
|
|
|
@ -262,14 +262,14 @@ describe("formats", () => {
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const { code } = svelte.compile(source, {
|
|
|
|
const { js } = svelte.compile(source, {
|
|
|
|
format: "eval",
|
|
|
|
format: "eval",
|
|
|
|
globals: {
|
|
|
|
globals: {
|
|
|
|
answer: "answer"
|
|
|
|
answer: "answer"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return testEval(code, "Foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
return testEval(js.code, "Foo", { answer: 42 }, `<div>42</div>`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|