Fix styles-ssr timeout (#1891)

This commit is contained in:
Drew Powers 2021-11-18 15:18:59 -07:00 committed by GitHub
parent 637cf499fa
commit 36f2f5d33e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,27 +2,25 @@ import { expect } from 'chai';
import cheerio from 'cheerio'; import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js'; import { loadFixture } from './test-utils.js';
describe('Styles SSR', function () { let fixture;
this.timeout(10000); let index$;
let bundledCSS;
let fixture; before(async () => {
let index$; fixture = await loadFixture({
let bundledCSS; projectRoot: './fixtures/astro-styles-ssr/',
renderers: ['@astrojs/renderer-react', '@astrojs/renderer-svelte', '@astrojs/renderer-vue'],
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-styles-ssr/',
renderers: ['@astrojs/renderer-react', '@astrojs/renderer-svelte', '@astrojs/renderer-vue'],
});
await fixture.build();
// get bundled CSS (will be hashed, hence DOM query)
const html = await fixture.readFile('/index.html');
index$ = cheerio.load(html);
const bundledCSSHREF = index$('link[rel=stylesheet][href^=assets/]').attr('href');
bundledCSS = await fixture.readFile(bundledCSSHREF.replace(/^\/?/, '/'));
}); });
await fixture.build();
// get bundled CSS (will be hashed, hence DOM query)
const html = await fixture.readFile('/index.html');
index$ = cheerio.load(html);
const bundledCSSHREF = index$('link[rel=stylesheet][href^=assets/]').attr('href');
bundledCSS = await fixture.readFile(bundledCSSHREF.replace(/^\/?/, '/'));
});
describe('Styles SSR', function () {
describe('Astro styles', () => { describe('Astro styles', () => {
it('HTML and CSS scoped correctly', async () => { it('HTML and CSS scoped correctly', async () => {
const $ = index$; const $ = index$;