TDD pattern development

This commit is contained in:
wuls 2023-03-30 10:44:28 +08:00
parent 4b077318fb
commit c440edf07f
6 changed files with 5981 additions and 5091 deletions

View file

@ -99,6 +99,7 @@
"dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.{ts,js}\"",
"postbuild": "astro-scripts copy \"src/**/*.astro\" && astro-scripts copy \"src/**/*.wasm\"",
"test:unit": "mocha --exit --timeout 30000 ./test/units/**/*.test.js",
"t": "mocha --exit --timeout 30000 ./test/astro-minification-html.test.js",
"test:unit:match": "mocha --exit --timeout 30000 ./test/units/**/*.test.js -g",
"test": "pnpm run test:unit && mocha --exit --timeout 20000 --ignore **/lit-element.test.js && mocha --timeout 20000 **/lit-element.test.js",
"test:match": "mocha --timeout 20000 -g",

View file

@ -0,0 +1,24 @@
import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { loadFixture, isWindows } from './test-utils.js';
describe('minification html', () => {
let fixture;
const regex = /[ \n]/;
before(async () => {
fixture = await loadFixture({ root: './fixtures/minification-html/' });
await fixture.build();
});
describe('Build', () => {
before(async () => {
await fixture.build();
});
it('validating the html is or not is minification ', async () => {
const html = await fixture.readFile('/index.html');
expect(regex.test(html)).to.equal(false);
});
});
});

View file

@ -0,0 +1,6 @@
import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({
compact: true
});

View file

@ -0,0 +1,8 @@
{
"name": "@test/minification-html",
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "workspace:*"
}
}

View file

@ -0,0 +1,14 @@
---
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>minimum html</title>
</head>
<body>
<main>
</main>
</body>
</html>

File diff suppressed because it is too large Load diff