Skip to content

Commit

Permalink
Fix empty pw tag (#171)
Browse files Browse the repository at this point in the history
* fix empty tag for playwright

* linter

* upd husky script

* upd
  • Loading branch information
olexandr13 authored Sep 19, 2024
1 parent b09eece commit 67e541c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint && npm run pretty-quick
npm run pretty-quick && npm run lint
10 changes: 7 additions & 3 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ function replaceAtPoint(subject, replaceAt, replaceTo) {
if (updateLine.includes('|')) {
lines[replaceAt.line - 1] = updateLine.replace(' |', `${replaceTo} |`);
} else {
/* prettier-ignore */
lines[replaceAt.line - 1] = updateLine.substring(0, replaceAt.column) + replaceTo + updateLine.substring(replaceAt.column);
lines[replaceAt.line - 1] =
updateLine.substring(0, replaceAt.column) + replaceTo + updateLine.substring(replaceAt.column);
}
return lines.join('\n');
}
Expand Down Expand Up @@ -150,7 +150,11 @@ const playwright = {
}
return prop.value.value;
})
.flat();
// flatten array of arrays
.flat()
// remove empty values
.filter(Boolean);

// remove @ at start of each tag
tags = tags.map(tag => {
return tag.startsWith('@') ? tag.substring(1) : tag;
Expand Down
1 change: 0 additions & 1 deletion src/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class Reporter {

const data = JSON.stringify({ ...opts, tests: this.tests, framework: this.framework });


debug('Sending test data to Testomat.io', data);
const req = request(
`${URL.trim()}/api/load?api_key=${this.apiKey}`,
Expand Down

0 comments on commit 67e541c

Please sign in to comment.