Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wide-adults-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix build errors being ignored when build.concurrency > 1
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ async function generatePage(
const path = paths[i];
promises.push(limit(() => generatePathWithLogs(path, route, i, paths, true)));
}
await Promise.allSettled(promises);
await Promise.all(promises);
} else {
for (let i = 0; i < paths.length; i++) {
const path = paths[i];
Expand Down
29 changes: 29 additions & 0 deletions packages/astro/test/build-concurrency.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { loadFixture } from './test-utils.js';

describe('Building with concurrency > 1', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;

before(async () => {
fixture = await loadFixture({
root: './fixtures/build-concurrency/',
build: {
concurrency: 2,
},
});
});

it('Errors and exits', async () => {
let built = false
try {
await fixture.build();
built = true
} catch (err) {
assert.match(err.message, /This is a test/)
}

assert.equal(built, false, 'Build should not complete');
});
});
8 changes: 8 additions & 0 deletions packages/astro/test/fixtures/build-concurrency/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@test/concurrency",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
throw Error('This is a test')
---

<h1>Hello world!</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

<h1>Page 2</h1>
7 changes: 6 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.