diff --git a/packages/astro/test/astro-minification-html.test.js b/packages/astro/test/astro-minification-html.test.js index 27cfd58d4..cbecd677b 100644 --- a/packages/astro/test/astro-minification-html.test.js +++ b/packages/astro/test/astro-minification-html.test.js @@ -3,22 +3,40 @@ import * as cheerio from 'cheerio'; import { loadFixture, isWindows } from './test-utils.js'; describe('minification html', () => { - let fixture; - const regex = /[\r\n]+/gm; - before(async () => { - fixture = await loadFixture({ root: './fixtures/minification-html/' }); - await fixture.build(); - }); - - describe('Build', () => { + describe('in the dev', () => { + let fixture; + let devServer; + const regex = /[\r\n]+/gm; before(async () => { + fixture = await loadFixture({ + root: './fixtures/minification-html/', + }); + devServer = await fixture.startDevServer(); + }); + + after(async () => { + devServer.stop(); + }); + + it('Verify that the HTML code is compressed in the dev', async () => { + let res = await fixture.fetch(`/`); + expect(res.status).to.equal(200); + const html = await res.text(); + expect(regex.test(html.slice(-100))).to.equal(false); + }); + + }) + describe('build', () => { + let fixture; + const regex = /[\r\n]+/gm; + before(async () => { + fixture = await loadFixture({ root: './fixtures/minification-html/' }); await fixture.build(); }); - it('validating the html is or not is minification ', async () => { + it('Verify that the HTML code is compressed in the pro', async () => { const html = await fixture.readFile('/index.html'); expect(regex.test(html.slice(20))).to.equal(false); }); - - }); + }) });