mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
[ci] yarn format
This commit is contained in:
parent
e28d5cb9de
commit
4df98a79f8
2 changed files with 28 additions and 22 deletions
|
@ -86,17 +86,24 @@ export async function build(astroConfig: AstroConfig, logging: LogOptions = defa
|
||||||
site: astroConfig.buildOptions.site,
|
site: astroConfig.buildOptions.site,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.filename) {
|
if (e.filename) {
|
||||||
let stack = e.stack.replace(/Object\.__render \(/gm, '').replace(/\/_astro\/(.+)\.astro\.js\:\d+\:\d+\)/gm, (_: string, $1: string) => 'file://' + fileURLToPath(projectRoot) + $1 + '.astro').split('\n');
|
let stack = e.stack
|
||||||
stack.splice(1, 0, ` at file://${e.filename}`)
|
.replace(/Object\.__render \(/gm, '')
|
||||||
stack = stack.join('\n')
|
.replace(/\/_astro\/(.+)\.astro\.js\:\d+\:\d+\)/gm, (_: string, $1: string) => 'file://' + fileURLToPath(projectRoot) + $1 + '.astro')
|
||||||
|
.split('\n');
|
||||||
|
stack.splice(1, 0, ` at file://${e.filename}`);
|
||||||
|
stack = stack.join('\n');
|
||||||
|
|
||||||
error(logging, 'build', `${red(`Unable to render ${underline(e.filename.replace(fileURLToPath(projectRoot), ''))}`)}
|
error(
|
||||||
|
logging,
|
||||||
|
'build',
|
||||||
|
`${red(`Unable to render ${underline(e.filename.replace(fileURLToPath(projectRoot), ''))}`)}
|
||||||
|
|
||||||
${stack}
|
${stack}
|
||||||
`);
|
`
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
error(logging, 'build', e);
|
error(logging, 'build', e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,9 @@ Throwable('Can throw an error from an `.astro` file', async ({ runtime }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Throwable('Does not complete build when Error is thrown', async ({ build }) => {
|
Throwable('Does not complete build when Error is thrown', async ({ build }) => {
|
||||||
await build().catch(e => {
|
await build().catch((e) => {
|
||||||
assert.ok(e, 'Build threw');
|
assert.ok(e, 'Build threw');
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Throwable.run();
|
Throwable.run();
|
||||||
|
|
Loading…
Add table
Reference in a new issue