Skip to content

Commit

Permalink
chore: add errors
Browse files Browse the repository at this point in the history
  • Loading branch information
crnsh committed Mar 7, 2024
1 parent 372afe9 commit 8b3e4b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "million-lint-check",
"version": "1.0.10",
"version": "1.0.11",
"description": "A command-line tool to verify if Million Lint is active in a project.",
"main": "index.js",
"files": [
Expand Down
6 changes: 4 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function checkWhetherMillionWorks( port: number, devServer: ChildPr
const url = `http://localhost:${port}`
const page = await tryConnect(url, browser, 100)
if (!page) {
exit()
throw new Error("Could not connect to page!")
}
await page.goto(url, { waitUntil: ['networkidle0', 'load'] });

Expand All @@ -46,14 +46,16 @@ export async function checkWhetherMillionWorks( port: number, devServer: ChildPr
await fuzzPage(page);

// check whether the element that has class name 'million-embed' also has class name 'active'
console.log(`Finding element...`);
console.log(`Finding Million Element...`);
const isActiveHandle = await page.evaluateHandle(() => {
const element = document!.querySelector("body > div:nth-child(4)")!.shadowRoot!.querySelector("div > div")
return element?.classList.contains('active')
});
const active = await isActiveHandle.jsonValue()
if (active) {
console.log('Million Lint is working as expected!');
} else {
throw new Error('Million not working!')
}

await browser.close();
Expand Down

0 comments on commit 8b3e4b4

Please sign in to comment.