fix flakey windows tests (#2795)

This commit is contained in:
Fred K. Schott 2022-03-15 05:37:29 -07:00 committed by GitHub
parent 0e4662df01
commit c36527f46d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 36 additions and 33 deletions

View file

@ -269,7 +269,7 @@ describe('CSS', function () {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('resolves CSS in public/', async () => { it('resolves CSS in public/', async () => {

View file

@ -16,7 +16,7 @@ describe('Astro basics', () => {
// important: close preview server (free up port and connection) // important: close preview server (free up port and connection)
after(async () => { after(async () => {
if (previewServer) await previewServer.stop(); await previewServer.stop();
}); });
describe('build', () => { describe('build', () => {

View file

@ -28,7 +28,7 @@ describe('getStaticPaths - 404 behavior', () => {
}); });
after(async () => { after(async () => {
devServer && devServer.stop(); devServer.stop();
}); });
it('resolves 200 on matching static path - named params', async () => { it('resolves 200 on matching static path - named params', async () => {

View file

@ -14,7 +14,7 @@ describe('Partial HTML ', async () => {
}); });
after(async () => { after(async () => {
devServer && devServer.stop(); await devServer.stop();
}); });
it('injects Astro styles and scripts', async () => { it('injects Astro styles and scripts', async () => {

View file

@ -15,8 +15,6 @@ describe('Sitemaps', () => {
await fixture.build(); await fixture.build();
}); });
after(() => fixture.clean());
describe('RSS Generation', () => { describe('RSS Generation', () => {
it('generates RSS correctly', async () => { it('generates RSS correctly', async () => {
const rss = await fixture.readFile('/custom/feed.xml'); const rss = await fixture.readFile('/custom/feed.xml');
@ -58,8 +56,6 @@ describe('Sitemaps served from subdirectory', () => {
await fixture.build(); await fixture.build();
}); });
after(() => fixture.clean());
describe('Sitemap Generation', () => { describe('Sitemap Generation', () => {
it('Generates Sitemap correctly', async () => { it('Generates Sitemap correctly', async () => {
let sitemap = await fixture.readFile('/sitemap.xml'); let sitemap = await fixture.readFile('/sitemap.xml');

View file

@ -25,6 +25,12 @@ describe('astro cli', () => {
expect(proc.stdout).to.include(pkgVersion); expect(proc.stdout).to.include(pkgVersion);
}); });
it('astro build', async () => {
const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url);
const proc = await cli('build', '--project-root', fileURLToPath(projectRootURL));
expect(proc.stdout).to.include('Done');
});
it('astro dev welcome', async () => { it('astro dev welcome', async () => {
const pkgURL = new URL('../package.json', import.meta.url); const pkgURL = new URL('../package.json', import.meta.url);
const pkgVersion = await fs.readFile(pkgURL, 'utf8').then((data) => JSON.parse(data).version); const pkgVersion = await fs.readFile(pkgURL, 'utf8').then((data) => JSON.parse(data).version);
@ -93,11 +99,4 @@ describe('astro cli', () => {
}); });
}); });
it('astro build', async () => {
const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url);
const proc = await cli('build', '--project-root', fileURLToPath(projectRootURL));
expect(proc.stdout).to.include('Done');
});
}); });

View file

@ -19,7 +19,7 @@ describe('<Debug />', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('Works in markdown pages', async () => { it('Works in markdown pages', async () => {

View file

@ -15,7 +15,7 @@ describe('Development Routing', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('200 when loading /', async () => { it('200 when loading /', async () => {
@ -56,7 +56,7 @@ describe('Development Routing', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('200 when loading /', async () => { it('200 when loading /', async () => {
@ -92,7 +92,7 @@ describe('Development Routing', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('404 when loading /', async () => { it('404 when loading /', async () => {
@ -138,7 +138,7 @@ describe('Development Routing', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('404 when loading /', async () => { it('404 when loading /', async () => {
@ -184,7 +184,7 @@ describe('Development Routing', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('200 when loading /home.json', async () => { it('200 when loading /home.json', async () => {

View file

@ -0,0 +1 @@
/dist-*

View file

@ -12,6 +12,7 @@ describe('Preview Routing', () => {
before(async () => { before(async () => {
fixture = await loadFixture({ fixture = await loadFixture({
projectRoot: './fixtures/with-subpath-no-trailing-slash/', projectRoot: './fixtures/with-subpath-no-trailing-slash/',
dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4000/', import.meta.url),
buildOptions: { buildOptions: {
pageUrlFormat: 'directory', pageUrlFormat: 'directory',
}, },
@ -25,7 +26,7 @@ describe('Preview Routing', () => {
}); });
after(async () => { after(async () => {
previewServer && (await previewServer.stop()); (await previewServer.stop());
}); });
it('404 when loading /', async () => { it('404 when loading /', async () => {
@ -69,6 +70,7 @@ describe('Preview Routing', () => {
before(async () => { before(async () => {
fixture = await loadFixture({ fixture = await loadFixture({
projectRoot: './fixtures/with-subpath-no-trailing-slash/', projectRoot: './fixtures/with-subpath-no-trailing-slash/',
dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4001/', import.meta.url),
devOptions: { devOptions: {
trailingSlash: 'always', trailingSlash: 'always',
port: 4001, port: 4001,
@ -79,7 +81,7 @@ describe('Preview Routing', () => {
}); });
after(async () => { after(async () => {
previewServer && (await previewServer.stop()); (await previewServer.stop());
}); });
it('404 when loading /', async () => { it('404 when loading /', async () => {
@ -127,6 +129,7 @@ describe('Preview Routing', () => {
before(async () => { before(async () => {
fixture = await loadFixture({ fixture = await loadFixture({
projectRoot: './fixtures/with-subpath-no-trailing-slash/', projectRoot: './fixtures/with-subpath-no-trailing-slash/',
dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4002//', import.meta.url),
devOptions: { devOptions: {
trailingSlash: 'ignore', trailingSlash: 'ignore',
port: 4002, port: 4002,
@ -137,7 +140,7 @@ describe('Preview Routing', () => {
}); });
after(async () => { after(async () => {
previewServer && (await previewServer.stop()); (await previewServer.stop());
}); });
it('404 when loading /', async () => { it('404 when loading /', async () => {
@ -187,6 +190,7 @@ describe('Preview Routing', () => {
before(async () => { before(async () => {
fixture = await loadFixture({ fixture = await loadFixture({
projectRoot: './fixtures/with-subpath-no-trailing-slash/', projectRoot: './fixtures/with-subpath-no-trailing-slash/',
dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4003/', import.meta.url),
buildOptions: { buildOptions: {
pageUrlFormat: 'file', pageUrlFormat: 'file',
}, },
@ -200,7 +204,7 @@ describe('Preview Routing', () => {
}); });
after(async () => { after(async () => {
previewServer && (await previewServer.stop()); (await previewServer.stop());
}); });
it('404 when loading /', async () => { it('404 when loading /', async () => {
@ -244,6 +248,7 @@ describe('Preview Routing', () => {
before(async () => { before(async () => {
fixture = await loadFixture({ fixture = await loadFixture({
projectRoot: './fixtures/with-subpath-no-trailing-slash/', projectRoot: './fixtures/with-subpath-no-trailing-slash/',
dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4004/', import.meta.url),
buildOptions: { buildOptions: {
pageUrlFormat: 'file', pageUrlFormat: 'file',
}, },
@ -257,7 +262,7 @@ describe('Preview Routing', () => {
}); });
after(async () => { after(async () => {
previewServer && (await previewServer.stop()); (await previewServer.stop());
}); });
it('404 when loading /', async () => { it('404 when loading /', async () => {
@ -305,6 +310,7 @@ describe('Preview Routing', () => {
before(async () => { before(async () => {
fixture = await loadFixture({ fixture = await loadFixture({
projectRoot: './fixtures/with-subpath-no-trailing-slash/', projectRoot: './fixtures/with-subpath-no-trailing-slash/',
dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4005/', import.meta.url),
buildOptions: { buildOptions: {
pageUrlFormat: 'file', pageUrlFormat: 'file',
}, },
@ -318,7 +324,7 @@ describe('Preview Routing', () => {
}); });
after(async () => { after(async () => {
previewServer && (await previewServer.stop()); (await previewServer.stop());
}); });
it('404 when loading /', async () => { it('404 when loading /', async () => {
@ -366,6 +372,7 @@ describe('Preview Routing', () => {
before(async () => { before(async () => {
fixture = await loadFixture({ fixture = await loadFixture({
projectRoot: './fixtures/with-subpath-no-trailing-slash/', projectRoot: './fixtures/with-subpath-no-trailing-slash/',
dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4006/', import.meta.url),
buildOptions: { buildOptions: {
pageUrlFormat: 'file', pageUrlFormat: 'file',
}, },
@ -379,7 +386,7 @@ describe('Preview Routing', () => {
}); });
after(async () => { after(async () => {
previewServer && (await previewServer.stop()); (await previewServer.stop());
}); });
it('404 when loading /', async () => { it('404 when loading /', async () => {

View file

@ -85,7 +85,7 @@ describe('React Components', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('scripts proxy correctly', async () => { it('scripts proxy correctly', async () => {

View file

@ -14,7 +14,7 @@ describe('Sass', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
// TODO: Sass cannot be found on macOS for some reason... Vite issue? // TODO: Sass cannot be found on macOS for some reason... Vite issue?

View file

@ -39,7 +39,7 @@ describe('Solid component', () => {
}); });
after(async () => { after(async () => {
devServer & devServer.stop(); await devServer.stop();
}); });
it('scripts proxy correctly', async () => { it('scripts proxy correctly', async () => {

View file

@ -38,7 +38,7 @@ describe('Svelte component', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('scripts proxy correctly', async () => { it('scripts proxy correctly', async () => {

View file

@ -53,7 +53,7 @@ describe('Vue component', () => {
}); });
after(async () => { after(async () => {
devServer && (await devServer.stop()); (await devServer.stop());
}); });
it('scripts proxy correctly', async () => { it('scripts proxy correctly', async () => {