summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/astro/test/astro-css-bundling-nested-layouts.test.js1
-rw-r--r--packages/astro/test/astro-dynamic.test.js1
-rw-r--r--packages/astro/test/errors.test.js52
-rw-r--r--packages/astro/test/svelte-component.test.js3
-rw-r--r--packages/create-astro/test/create-astro.test.js1
5 files changed, 52 insertions, 6 deletions
diff --git a/packages/astro/test/astro-css-bundling-nested-layouts.test.js b/packages/astro/test/astro-css-bundling-nested-layouts.test.js
index f324f9d71..e85b78e2e 100644
--- a/packages/astro/test/astro-css-bundling-nested-layouts.test.js
+++ b/packages/astro/test/astro-css-bundling-nested-layouts.test.js
@@ -29,7 +29,6 @@ describe('nested layouts', () => {
const stylesheets = $('link[rel=stylesheet]')
.toArray()
.map((el) => el.attribs.href);
- console.log({ stylesheets });
// page-one.[hash].css exists
expect(stylesheets.some((href) => /page-one\.\w+\.css/.test(href))).to.be.true;
diff --git a/packages/astro/test/astro-dynamic.test.js b/packages/astro/test/astro-dynamic.test.js
index a61baeda2..fedccfd5a 100644
--- a/packages/astro/test/astro-dynamic.test.js
+++ b/packages/astro/test/astro-dynamic.test.js
@@ -37,7 +37,6 @@ describe('Dynamic components', () => {
// test 1: <astro-root> is empty
expect($('<astro-root>').html()).to.equal('');
const script = $('script').text();
- console.log(script);
// Grab the svelte import
// const exp = /import\("(.+?)"\)/g;
diff --git a/packages/astro/test/errors.test.js b/packages/astro/test/errors.test.js
index d78eccf37..4d29361a4 100644
--- a/packages/astro/test/errors.test.js
+++ b/packages/astro/test/errors.test.js
@@ -19,39 +19,53 @@ describe('Error display', () => {
describe('Astro', () => {
it('syntax error in template', async () => {
const res = await fixture.fetch('/astro-syntax-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
- console.log(res.body);
+
expect(body).to.include('Unexpected &quot;}&quot;');
});
it('syntax error in frontmatter', async () => {
const res = await fixture.fetch('/astro-frontmatter-syntax-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
- console.log(res.body);
+
expect(body).to.include('Unexpected end of frontmatter');
});
it('runtime error', async () => {
const res = await fixture.fetch('/astro-runtime-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('ReferenceError: title is not defined');
+
// TODO: improve and test stacktrace
});
it('hydration error', async () => {
const res = await fixture.fetch('/astro-hydration-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Error: invalid hydration directive');
});
it('client:media error', async () => {
const res = await fixture.fetch('/astro-client-media-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Error: Media query must be provided');
});
});
@@ -59,15 +73,21 @@ describe('Error display', () => {
describe('JS', () => {
it('syntax error', async () => {
const res = await fixture.fetch('/js-syntax-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Parse failure');
});
it('runtime error', async () => {
const res = await fixture.fetch('/js-runtime-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('ReferenceError: undefinedvar is not defined');
});
});
@@ -75,15 +95,21 @@ describe('Error display', () => {
describe('Preact', () => {
it('syntax error', async () => {
const res = await fixture.fetch('/preact-syntax-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Syntax error');
});
it('runtime error', async () => {
const res = await fixture.fetch('/preact-runtime-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Error: PreactRuntimeError');
});
});
@@ -91,15 +117,21 @@ describe('Error display', () => {
describe('React', () => {
it('syntax error', async () => {
const res = await fixture.fetch('/react-syntax-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Syntax error');
});
it('runtime error', async () => {
const res = await fixture.fetch('/react-runtime-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Error: ReactRuntimeError');
});
});
@@ -107,15 +139,21 @@ describe('Error display', () => {
describe('Solid', () => {
it('syntax error', async () => {
const res = await fixture.fetch('/solid-syntax-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Syntax error');
});
it('runtime error', async () => {
const res = await fixture.fetch('/solid-runtime-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Error: SolidRuntimeError');
});
});
@@ -123,15 +161,21 @@ describe('Error display', () => {
describe('Svelte', () => {
it('syntax error', async () => {
const res = await fixture.fetch('/svelte-syntax-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Internal Error');
});
it('runtime error', async () => {
const res = await fixture.fetch('/svelte-runtime-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.include('Error: SvelteRuntimeError');
});
});
@@ -140,14 +184,18 @@ describe('Error display', () => {
it('syntax error', async () => {
const res = await fixture.fetch('/vue-syntax-error');
const body = await res.text();
+
expect(res.status).to.equal(500);
expect(body).to.include('Parse failure');
});
it('runtime error', async () => {
const res = await fixture.fetch('/vue-runtime-error');
+
expect(res.status).to.equal(500);
+
const body = await res.text();
+
expect(body).to.match(/Cannot read.*undefined/); // note: error differs slightly between Node versions
});
});
diff --git a/packages/astro/test/svelte-component.test.js b/packages/astro/test/svelte-component.test.js
index 4e4ef5e56..35da190ad 100644
--- a/packages/astro/test/svelte-component.test.js
+++ b/packages/astro/test/svelte-component.test.js
@@ -45,8 +45,9 @@ describe('Svelte component', () => {
for (const script of $('script').toArray()) {
const { src } = script.attribs;
+
if (!src) continue;
- console.log({ src });
+
expect((await fixture.fetch(src)).status, `404: ${src}`).to.equal(200);
}
});
diff --git a/packages/create-astro/test/create-astro.test.js b/packages/create-astro/test/create-astro.test.js
index e0a5cc7ce..1395fe463 100644
--- a/packages/create-astro/test/create-astro.test.js
+++ b/packages/create-astro/test/create-astro.test.js
@@ -34,7 +34,6 @@ async function fetch(url) {
function assert(a, b, message) {
if (a !== b) throw new Error(red(`✘ ${message}`));
- // console.log(green(`✔ ${message}`)); // don’t show successes
}
async function testTemplate(template) {