astro/packages/astro/test/static-build-frameworks.test.js

42 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { loadFixture, isWindows } from './test-utils.js';
describe('Static build - frameworks', () => {
if (isWindows) {
return;
}
let fixture;
before(async () => {
fixture = await loadFixture({
root: './fixtures/static-build-frameworks/',
});
await fixture.build();
});
it('can build preact', async () => {
const html = await fixture.readFile('/preact/index.html');
expect(html).to.be.a('string');
});
it('can build react', async () => {
const html = await fixture.readFile('/react/index.html');
expect(html).to.be.a('string');
});
// SKIP: Lit polyfills the server in a way that breaks `sass` require/import
// Leads to CI bugs like: "Cannot read properties of undefined (reading 'length')"
it.skip('can build lit', async () => {
const html = await fixture.readFile('/lit/index.html');
expect(html).to.be.a('string');
});
it('can build nested framework usage', async () => {
const html = await fixture.readFile('/nested/index.html');
const $ = cheerio.load(html);
const counter = $('.nested-counter .counter');
expect(counter.length).to.equal(1, 'Found the counter');
});
});