TDD pattern development
This commit is contained in:
parent
4b077318fb
commit
c440edf07f
6 changed files with 5981 additions and 5091 deletions
|
@ -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}\"",
|
"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\"",
|
"postbuild": "astro-scripts copy \"src/**/*.astro\" && astro-scripts copy \"src/**/*.wasm\"",
|
||||||
"test:unit": "mocha --exit --timeout 30000 ./test/units/**/*.test.js",
|
"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: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": "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",
|
"test:match": "mocha --timeout 20000 -g",
|
||||||
|
|
24
packages/astro/test/astro-minification-html.test.js
Normal file
24
packages/astro/test/astro-minification-html.test.js
Normal 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);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
6
packages/astro/test/fixtures/minification-html/astro.config.mjs
vendored
Normal file
6
packages/astro/test/fixtures/minification-html/astro.config.mjs
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
|
// https://astro.build/config
|
||||||
|
export default defineConfig({
|
||||||
|
compact: true
|
||||||
|
});
|
8
packages/astro/test/fixtures/minification-html/package.json
vendored
Normal file
8
packages/astro/test/fixtures/minification-html/package.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"name": "@test/minification-html",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"astro": "workspace:*"
|
||||||
|
}
|
||||||
|
}
|
14
packages/astro/test/fixtures/minification-html/src/pages/index.astro
vendored
Normal file
14
packages/astro/test/fixtures/minification-html/src/pages/index.astro
vendored
Normal 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>
|
11019
pnpm-lock.yaml
11019
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue