Skip to content

Commit 6235805

Browse files
committed
Update the script builder
1 parent 83dc4a9 commit 6235805

File tree

9 files changed

+106
-108
lines changed

9 files changed

+106
-108
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ dist
33
/test-results/
44
/playwright-report/
55
/playwright/.cache/
6-
tests/GeneratorScript.js

package-lock.json

Lines changed: 97 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"type": "module",
88
"scripts": {
99
"build": "tsc",
10-
"test": "npm run build && node tests/build.js && npx playwright test"
10+
"postbuild": "node post-build.js",
11+
"test": "npm run build && npx playwright test"
1112
},
1213
"repository": {
1314
"type": "git",
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import fs from 'fs';
22

3-
const file = fs.readFileSync('dist/Generator.js', { encoding: 'utf-8' });
4-
5-
let script = file;
3+
let script = fs.readFileSync('dist/Generator.js', { encoding: 'utf-8' });
64
script = script.replace('export ', '');
75
script = script.replace(/\/\/# sourceMappingURL=[a-z\.]+/i, '');
86

9-
fs.writeFileSync('tests/GeneratorScript.js', script, { encoding: 'utf-8' });
7+
fs.writeFileSync('dist/Generator.script.js', script, { encoding: 'utf-8' });
108

119
console.log('Done.');

tests/cascading.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ a {
1717
`;
1818

1919
test('Cascading', async ({ page }) => {
20-
await page.addScriptTag({ path: './tests/GeneratorScript.js' });
20+
await page.addScriptTag({ path: './dist/Generator.script.js' });
2121

2222
const result = await page.evaluate(async (css) => {
2323
document.body = cssToHtml(css);

tests/comma.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ p.content {
1414
`;
1515

1616
test('Comma', async ({ page }) => {
17-
await page.addScriptTag({ path: './tests/GeneratorScript.js' });
17+
await page.addScriptTag({ path: './dist/Generator.script.js' });
1818

1919
const result = await page.evaluate(async (css) => {
2020
document.body = cssToHtml(css);

tests/ignored.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ div:hover {
2424
`;
2525

2626
test('Ignored', async ({ page }) => {
27-
await page.addScriptTag({ path: './tests/GeneratorScript.js' });
27+
await page.addScriptTag({ path: './dist/Generator.script.js' });
2828

2929
const result = await page.evaluate(async (css) => {
3030
document.body = cssToHtml(css);

tests/nth-child.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ span:last-child {
2121
`;
2222

2323
test('Nth-Child', async ({ page }) => {
24-
await page.addScriptTag({ path: './tests/GeneratorScript.js' });
24+
await page.addScriptTag({ path: './dist/Generator.script.js' });
2525

2626
const result = await page.evaluate(async (css) => {
2727
document.body = cssToHtml(css);

tests/selector.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ nav>a#logo.icon > img {
2222
const html = `<body xmlns="http://www.w3.org/1999/xhtml"><div id="cat"></div><div class="mouse"><span class="flea"></span><i></i></div><nav><a class="icon" id="logo"><img src="https://example.com/image2" /></a></nav></body>`;
2323

2424
test('Selector', async ({ page }) => {
25-
await page.addScriptTag({ path: './tests/GeneratorScript.js' });
25+
await page.addScriptTag({ path: './dist/Generator.script.js' });
2626

2727
const result = await page.evaluate(async ([css, html]) => {
2828
document.body = cssToHtml(css);

0 commit comments

Comments
 (0)