Skip to content

Commit

Permalink
chore: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
barjin committed Nov 2, 2023
1 parent 384e0c9 commit b051b86
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/live-testing/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { readFileSync } from 'fs';
import { setTimeout } from 'timers/promises';
import { gotScraping } from '../../dist/index.js';

Check failure on line 2 in test/live-testing/index.js

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
import got from 'got';

Check failure on line 3 in test/live-testing/index.js

View workflow job for this annotation

GitHub Actions / Lint

`got` import should occur before import of `../../dist/index.js`
Expand All @@ -8,10 +7,10 @@ async function processUrls(gotImplementation, urls) {
let blocked = 0;
let failed = 0;

let url = null;
while (url = urls.shift()) {
let url = urls.shift();
while (url) {
try {
//console.log(`crawling ${url}`);
// console.log(`crawling ${url}`);
const request = gotImplementation.get(url);

const result = await Promise.race([
Expand All @@ -24,7 +23,7 @@ async function processUrls(gotImplementation, urls) {
throw new Error('timeout');
}

//console.log(`crawled ${url}`);
// console.log(`crawled ${url}`);

if (result.body.includes('Just a moment...')) {
blocked++;
Expand All @@ -33,12 +32,13 @@ async function processUrls(gotImplementation, urls) {
}
} catch (e) {
failed++;
//console.error(e.message);
continue;
// console.error(e.message);
}

Check failure on line 37 in test/live-testing/index.js

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
url = urls.shift();
}

//console.log('done!');
// console.log('done!');
return { passed, blocked, failed };
}

Expand All @@ -51,11 +51,11 @@ async function runInParallel(implementation, urls) {
acc.blocked += blocked;
acc.failed += failed;
return acc;
}, {passed: 0, blocked: 0, failed: 0});
}, { passed: 0, blocked: 0, failed: 0 });
}

(async () => {
const { body } = await got.get('https://raw.githubusercontent.com/apify/fingerprint-suite/master/test/antibot-services/live-testing/cloudflare-websites.csv')
const { body } = await got.get('https://raw.githubusercontent.com/apify/fingerprint-suite/master/test/antibot-services/live-testing/cloudflare-websites.csv');
const urls = body.split('\n');

const [gotScrapingResults, gotResults] = await Promise.all([
Expand Down

0 comments on commit b051b86

Please sign in to comment.