Skip to content

Commit b31e5ce

Browse files
committed
style: reformat / fix to comply with Biome lint rules
1 parent 088e9da commit b31e5ce

File tree

258 files changed

+1798
-2265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+1798
-2265
lines changed

.github/workflows/scripts/get-all-packages-by-name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fs = require('fs');
1+
const fs = require('node:fs');
22

33
const packageNames = [];
44
fs.readdirSync('packages').forEach((pkg) => {

.github/workflows/scripts/get-tests-in-package-location.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const fs = require('fs');
2-
const path = require('path');
1+
const fs = require('node:fs');
2+
const path = require('node:path');
33

44
/**
55
* This script is used to discover all the tests in different test directories that match a specific suffix
@@ -9,17 +9,17 @@ const path = require('path');
99
const testLocations = [
1010
{
1111
location: 'test/cloud-e2e/fargate',
12-
package: 'artillery',
12+
packageName: 'artillery',
1313
suffix: '.test.js'
1414
},
1515
{
1616
location: 'test/cloud-e2e/lambda',
17-
package: 'artillery',
17+
packageName: 'artillery',
1818
suffix: '.test.js'
1919
},
2020
{
2121
location: 'test',
22-
package: 'artillery-engine-playwright',
22+
packageName: 'artillery-engine-playwright',
2323
suffix: '.aws.js'
2424
}
2525
];
@@ -38,7 +38,7 @@ const addTest = (fileName, baseLocation, packageName, suffix) => {
3838
tests.names.push(jobName);
3939
tests.namesToFiles[jobName] = {
4040
file: `${baseLocation}/${fileName}`,
41-
package: packageName
41+
packageName: packageName
4242
};
4343
};
4444

@@ -55,9 +55,9 @@ function scanDirectory(location, baseLocation, packageName, suffix) {
5555
}
5656

5757
// Scan all the test locations
58-
for (const { package, location, suffix } of testLocations) {
59-
const fullLocation = `packages/${package}/${location}`;
60-
scanDirectory(fullLocation, location, package, suffix);
58+
for (const { packageName, location, suffix } of testLocations) {
59+
const fullLocation = `packages/${packageName}/${location}`;
60+
scanDirectory(fullLocation, location, packageName, suffix);
6161
}
6262

6363
// Output the tests object as a JSON string to be used by Github Actions

.github/workflows/scripts/replace-package-versions.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
const fs = require('fs');
2-
const path = require('path');
1+
const fs = require('node:fs');
2+
const path = require('node:path');
33

44
const packagesDir = '../../../packages';
55
const commitSha = process.env.COMMIT_SHA;
66

77
const getNewVersion = (version) => {
8-
if (!commitSha || commitSha == 'null') {
8+
if (!commitSha || commitSha === 'null') {
99
return version;
1010
}
1111

1212
const shortSha = commitSha.slice(0, 7);
1313
return `${version}-${shortSha}`;
1414
};
1515

16-
let versionMapping = {};
16+
const versionMapping = {};
1717

1818
/**
1919
* This script iterates through every folder in ./packages and replaces their package.version with VERSION-COMMIT_SHA.
@@ -61,7 +61,7 @@ const updateDependencies = (pkg) => {
6161
} = pkg;
6262

6363
for (const packageNameToReplace of Object.keys(versionMapping)) {
64-
if (dependencies && dependencies[packageNameToReplace]) {
64+
if (dependencies?.[packageNameToReplace]) {
6565
//replace the dependency we care about in this package with its corrected canary version
6666
dependencies[packageNameToReplace] =
6767
versionMapping[packageNameToReplace].content.version;

examples/artillery-engine-example/index.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ class ExampleEngine {
2929
if (!opts.mandatoryString) {
3030
throw new Error('mandatoryString setting must be set');
3131
}
32-
33-
return this;
3432
}
3533

3634
// For each scenario in the script using this engine, Artillery calls this function
@@ -71,7 +69,7 @@ class ExampleEngine {
7169

7270
if (rs.log) {
7371
return function log(context, callback) {
74-
return process.nextTick(function () {
72+
return process.nextTick(() => {
7573
callback(null, context);
7674
});
7775
};
@@ -82,17 +80,15 @@ class ExampleEngine {
8280
}
8381

8482
if (rs.function) {
85-
return function (context, callback) {
86-
let func = self.script.config.processor[rs.function];
83+
return (context, callback) => {
84+
const func = self.script.config.processor[rs.function];
8785
if (!func) {
88-
return process.nextTick(function () {
86+
return process.nextTick(() => {
8987
callback(null, context);
9088
});
9189
}
9290

93-
return func(context, ee, function () {
94-
return callback(null, context);
95-
});
91+
return func(context, ee, () => callback(null, context));
9692
};
9793
}
9894

examples/artillery-engine-example/test/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
'use strict';
6-
75
const { test } = require('tap');
8-
const EventEmitter = require('events');
6+
const EventEmitter = require('node:events');
97

108
const ExampleEngine = require('..');
119

@@ -31,7 +29,7 @@ const script = {
3129
]
3230
};
3331

34-
test('Engine interface', async function (t) {
32+
test('Engine interface', async (t) => {
3533
const events = new EventEmitter();
3634
const engine = new ExampleEngine(script, events, {});
3735
const scenario = engine.createScenario(script.scenarios[0], events);

examples/artillery-plugin-hello-world/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ function ArtilleryHelloWorldPlugin(script, events) {
2222
const pluginConfig = script.config.plugins['hello-world'];
2323
this.greeting = pluginConfig.greeting || 'hello, world';
2424

25-
const self = this;
26-
2725
// But we could also read anything else defined in the test
2826
// script, e.g.:
2927
debug('target is:', script.config.target);
@@ -35,16 +33,16 @@ function ArtilleryHelloWorldPlugin(script, events) {
3533
// Create processor object if needed to hold our custom function:
3634
script.config.processor = script.config.processor || {};
3735
// Add our custom function:
38-
script.config.processor['pluginHelloWorldBeforeRequestHook'] = function (
39-
req,
40-
vuContext,
36+
script.config.processor.pluginHelloWorldBeforeRequestHook = (
37+
_req,
38+
_vuContext,
4139
events,
4240
next
43-
) {
41+
) => {
4442
// This a beforeRequest handler function:
4543
// https://artillery.io/docs/guides/guides/http-reference.html#beforeRequest
4644

47-
console.log(self.greeting); // print greeting
45+
console.log(this.greeting); // print greeting
4846
events.emit('counter', 'greeting_count', 1); // increase custom counter
4947
return next(); // the hook is done, go on to the next one (or let Artillery make the request)
5048
};
@@ -60,7 +58,7 @@ function ArtilleryHelloWorldPlugin(script, events) {
6058
// Artillery will call this before it exits to give plugins
6159
// a chance to clean up, e.g. by flushing any in-flight data,
6260
// writing something to disk etc.
63-
ArtilleryHelloWorldPlugin.prototype.cleanup = function (done) {
61+
ArtilleryHelloWorldPlugin.prototype.cleanup = (done) => {
6462
debug('cleaning up');
6563
done(null);
6664
};

examples/browser-load-testing-playwright/browser-load-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ export const scenarios = [
2727
name: 'check_out_core_concepts_scenario',
2828
testFunction: async function checkOutArtilleryCoreConceptsFlow(
2929
page,
30-
userContext,
31-
events,
30+
_userContext,
31+
_events,
3232
test
3333
) {
3434
await test.step('Go to Artillery', async () => {
3535
const requestPromise = page.waitForRequest('https://artillery.io/');
3636
await page.goto('https://artillery.io/');
37-
const req = await requestPromise;
37+
const _req = await requestPromise;
3838
});
3939
await test.step('Go to docs', async () => {
4040
await page.getByRole('link', { name: 'Docs' }).first().click();

examples/browser-load-testing-playwright/flows.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
//
66
async function checkOutArtilleryCoreConceptsFlow(
77
page,
8-
userContext,
9-
events,
8+
_userContext,
9+
_events,
1010
test
1111
) {
1212
await test.step('Go to Artillery', async () => {
1313
const requestPromise = page.waitForRequest('https://artillery.io/');
1414
await page.goto('https://artillery.io/');
15-
const req = await requestPromise;
15+
const _req = await requestPromise;
1616
});
1717
await test.step('Go to docs', async () => {
1818
await page.getByRole('link', { name: 'Docs' }).first().click();
@@ -56,7 +56,7 @@ async function checkPage(page, userContext, events) {
5656
}
5757
}
5858

59-
async function multistepWithCustomMetrics(page, userContext, events, test) {
59+
async function multistepWithCustomMetrics(page, _userContext, _events, test) {
6060
//1. we get the convenience step() helper from the test object.
6161
//More information: https://www.artillery.io/docs/reference/engines/playwright#teststep-argument
6262
const { step } = test;

examples/browser-playwright-reuse-authentication/flow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { expect } = require('@playwright/test');
2-
const fs = require('fs');
2+
const fs = require('node:fs');
33

44
async function loginUserAndSaveStorage(page, context) {
55
// NOTE: we use the $dirname utility so Playwright can resolve the full path
@@ -34,7 +34,7 @@ async function loginUserAndSaveStorage(page, context) {
3434
.storageState({ path: `${context.vars.$dirname}/storage.json` });
3535
}
3636

37-
async function goToProfilePageAndLogout(page, context, events, test) {
37+
async function goToProfilePageAndLogout(page, context, _events, test) {
3838
const { step } = test;
3939
const profileHeaderText = 'Profile (Static Generation, recommended)';
4040

examples/browser-playwright-reuse-typescript/e2e/helpers/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Page, expect } from '@playwright/test';
1+
import { type Page, expect } from '@playwright/test';
22

33
export const goToDocsAndSearch = async (page: Page, step) => {
44
await step('go_to_artillery_io', async () => {
@@ -8,9 +8,7 @@ export const goToDocsAndSearch = async (page: Page, step) => {
88
await step('go_to_docs', async () => {
99
await page.getByRole('link', { name: 'Docs' }).first().click();
1010
await expect(page).toHaveURL('/docs');
11-
await expect(
12-
page.getByText('Get started')
13-
).toBeVisible();
11+
await expect(page.getByText('Get started')).toBeVisible();
1412
});
1513

1614
await step('search_for_ts_doc_and_goto', async () => {

0 commit comments

Comments
 (0)