mirror of
https://github.com/withastro/astro.git
synced 2025-02-03 22:29:08 -05:00
* feat: implement redesign * fix: make it build * feat: visual tweaks * feat(overlay): update styling, integration endpoint * feat: add fallback icons * Clean up tests (#9183) * Add `@astrojs/upgrade` package for automatic package upgrades (#8525) Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * [ci] format * fix: links with same path but different search params not prefetched (#9189) Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * fix: discord icon * chore: changeset --------- Co-authored-by: Nate Moore <nate@astro.build> Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> Co-authored-by: Spencer Whitehead <35475068+SpencerWhitehead7@users.noreply.github.com> Co-authored-by: Matthew Phillips <matthew@skypack.dev>
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
import fs from 'node:fs';
|
|
import { setStdout } from '../dist/index.js';
|
|
import stripAnsi from 'strip-ansi';
|
|
|
|
export function setup() {
|
|
const ctx = { messages: [] };
|
|
before(() => {
|
|
setStdout(
|
|
Object.assign({}, process.stdout, {
|
|
write(buf) {
|
|
ctx.messages.push(stripAnsi(String(buf)).trim());
|
|
return true;
|
|
},
|
|
})
|
|
);
|
|
});
|
|
beforeEach(() => {
|
|
ctx.messages = [];
|
|
});
|
|
|
|
return {
|
|
messages() {
|
|
return ctx.messages;
|
|
},
|
|
length() {
|
|
return ctx.messages.length;
|
|
},
|
|
hasMessage(content) {
|
|
return !!ctx.messages.find((msg) => msg.includes(content));
|
|
},
|
|
};
|
|
}
|
|
|
|
const resetBasicFixture = async () => {
|
|
const packagePath = new URL('./fixtures/basic/package.json', import.meta.url);
|
|
const packageJsonData = JSON.parse(
|
|
await fs.promises.readFile(packagePath, { encoding: 'utf-8' })
|
|
);
|
|
const overriddenPackageJson = Object.assign(packageJsonData, {
|
|
dependencies: {
|
|
astro: '1.0.0',
|
|
},
|
|
});
|
|
|
|
return Promise.all([
|
|
fs.promises.writeFile(packagePath, JSON.stringify(overriddenPackageJson, null, 2), {
|
|
encoding: 'utf-8',
|
|
}),
|
|
]);
|
|
};
|
|
|
|
export const resetFixtures = () => Promise.allSettled([resetBasicFixture()]);
|