Skip to content

Commit

Permalink
Fix html tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardocavazza committed Mar 5, 2024
1 parent 4ab412b commit 986ae86
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"**/types/*",
"**/fixture/*",
"**/fixtures/*",
"**/test/out/*",
"public",
"docs/.vitepress/dist",
"docs/.vitepress/cache"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @param {import('plop').NodePlopAPI} plop
*/
module.exports = function (plop) {
export default (plop) => {
plop.setGenerator('module', {
description: 'RNA ecosystem module.',
prompts: [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"clear": "rimraf --glob 'packages/*/{types,*.tsbuildinfo}' 'packages/*/dist'",
"build": "yarn workspaces foreach --topological-dev --verbose run build",
"types": "rimraf --glob 'packages/*/{types,*.tsbuildinfo}' && tsc -b",
"lint": "prettier --check . && eslint 'packages/*/lib/**/*.js'",
"lint": "prettier --check . && eslint .",
"test": "vitest --coverage",
"new": "plop --plopfile internals/generators/plopfile.cjs module",
"docs:dev": "vitepress dev docs",
Expand All @@ -33,7 +33,7 @@
"chai-string": "^1.5.0",
"eslint": "^8.0.0",
"jsonc-parser": "^3.0.0",
"plop": "^3.1.2",
"plop": "^4.0.0",
"prettier": "^3.1.1",
"rimraf": "^5.0.1",
"typescript": "^5.0.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/esbuild-plugin-html/test/test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ html {
expect(css.path).endsWith(path.join(path.sep, 'out', 'index.css'));
});

it('should minify html', async () => {
test('should minify html', async () => {
const { outputFiles } = await esbuild.build({
absWorkingDir: fileURLToPath(new URL('.', import.meta.url)),
entryPoints: [fileURLToPath(new URL('fixture/index.iife.html', import.meta.url))],
Expand All @@ -1363,8 +1363,8 @@ html {
});

const [index] = outputFiles;
expect(index.text).to.be
.equal(`<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><script type="application/javascript">(function() {
expect(index.text)
.toBe(`<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><script type="application/javascript">(function() {
function loadStyle(url) {
var l = document.createElement('link');
l.rel = 'stylesheet';
Expand All @@ -1375,7 +1375,7 @@ loadStyle('/public/index.css');
}());</script></head><body> <script src="/public/index.js" type="application/javascript"></script> </body></html>`);
});

it('should minify html with minify option', async () => {
test('should minify html with minify option', async () => {
const { outputFiles } = await esbuild.build({
absWorkingDir: fileURLToPath(new URL('.', import.meta.url)),
entryPoints: [fileURLToPath(new URL('fixture/index.iife.html', import.meta.url))],
Expand All @@ -1398,8 +1398,8 @@ loadStyle('/public/index.css');
});

const [index] = outputFiles;
expect(index.text).to.be
.equal(`<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width, initial-scale=1.0"><title>Document</title><script type=application/javascript>(function() {
expect(index.text)
.toBe(`<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width, initial-scale=1.0"><title>Document</title><script type=application/javascript>(function() {
function loadStyle(url) {
var l = document.createElement('link');
l.rel = 'stylesheet';
Expand Down

0 comments on commit 986ae86

Please sign in to comment.