Skip to content

Commit

Permalink
Merge branch 'main' into costs-audit
Browse files Browse the repository at this point in the history
  • Loading branch information
solaris007 committed Aug 20, 2024
2 parents b212a05 + 80c3c16 commit 16774c2
Show file tree
Hide file tree
Showing 24 changed files with 1,201 additions and 898 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
{
files: ['*.test.js'],
rules: {
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
},
],
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [1.25.7](https://github.com/adobe/spacecat-audit-worker/compare/v1.25.6...v1.25.7) (2024-08-20)


### Bug Fixes

* **deps:** update dependency @adobe/spacecat-shared-data-access to v1.41.6 ([#368](https://github.com/adobe/spacecat-audit-worker/issues/368)) ([5ef8523](https://github.com/adobe/spacecat-audit-worker/commit/5ef8523020e93c8fc74649d1a860851549f3beb8))

## [1.25.6](https://github.com/adobe/spacecat-audit-worker/compare/v1.25.5...v1.25.6) (2024-08-19)


### Bug Fixes

* **deps:** update adobe fixes ([#366](https://github.com/adobe/spacecat-audit-worker/issues/366)) ([d803793](https://github.com/adobe/spacecat-audit-worker/commit/d803793d8fa1a1891536727d7dc4853bb9a4f743))

## [1.25.5](https://github.com/adobe/spacecat-audit-worker/compare/v1.25.4...v1.25.5) (2024-08-17)


Expand Down
1,948 changes: 1,130 additions & 818 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adobe/spacecat-audit-worker",
"version": "1.25.5",
"version": "1.25.7",
"description": "SpaceCat Audit Worker",
"main": "src/index.js",
"type": "module",
Expand Down Expand Up @@ -57,13 +57,13 @@
"@adobe/helix-universal": "5.0.5",
"@adobe/helix-universal-logger": "3.0.18",
"@adobe/spacecat-shared-ahrefs-client": "1.5.0",
"@adobe/spacecat-shared-data-access": "1.41.4",
"@adobe/spacecat-shared-http-utils": "1.6.5",
"@adobe/spacecat-shared-data-access": "1.41.6",
"@adobe/spacecat-shared-http-utils": "1.6.7",
"@adobe/spacecat-shared-rum-api-client": "2.7.3",
"@adobe/spacecat-shared-rum-api-client-v1": "npm:@adobe/[email protected]",
"@aws-sdk/client-lambda": "3.632.0",
"@aws-sdk/credential-provider-node": "3.632.0",
"@adobe/spacecat-shared-utils": "1.19.3",
"@adobe/spacecat-shared-utils": "1.19.4",
"@aws-sdk/client-secrets-manager": "3.632.0",
"@aws-sdk/client-sqs": "3.632.0",
"diff": "5.2.0",
Expand All @@ -81,15 +81,15 @@
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/npm": "12.0.1",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"@typescript-eslint/eslint-plugin": "8.2.0",
"@typescript-eslint/parser": "8.2.0",
"c8": "10.1.2",
"chai": "4.5.0",
"chai": "5.1.1",
"chai-as-promised": "8.0.0",
"dotenv": "16.4.5",
"eslint": "8.57.0",
"husky": "9.1.4",
"junit-report-builder": "3.2.1",
"junit-report-builder": "5.0.0",
"lint-staged": "15.2.9",
"mocha": "10.7.3",
"mocha-multi-reporters": "1.5.1",
Expand All @@ -98,7 +98,7 @@
"nodemon": "3.1.4",
"semantic-release": "24.1.0",
"sinon": "18.0.0",
"sinon-chai": "3.7.0",
"sinon-chai": "4.0.0",
"typescript": "5.5.4",
"yaml": "2.5.0"
},
Expand Down
6 changes: 0 additions & 6 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
],
"allowedVersions": ">=23.0"
},
{
"matchPackageNames": [
"chai"
],
"allowedVersions": "<5.0.0"
},
{
"matchPackageNames": [
"eslint"
Expand Down
6 changes: 3 additions & 3 deletions src/canonical/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export async function validateCanonicalTag(url, log) {
});
log.info(`Canonical URL ${canonicalUrl} does not reference itself`);
}
} catch (error) {
} catch {
checks.push({
check: CANONICAL_CHECKS.CANONICAL_URL_INVALID.check,
success: false,
Expand Down Expand Up @@ -273,7 +273,7 @@ export function validateCanonicalFormat(canonicalUrl, baseUrl, log) {

try {
base = new URL(baseUrl);
} catch (error) {
} catch {
log.error(`Invalid URL: ${baseUrl}`);
checks.push({
check: CANONICAL_CHECKS.URL_UNDEFINED.check,
Expand Down Expand Up @@ -326,7 +326,7 @@ export function validateCanonicalFormat(canonicalUrl, baseUrl, log) {

try {
url = new URL(canonicalUrl);
} catch (error) {
} catch {
log.error(`Invalid URL: ${canonicalUrl}`);
checks.push({
check: CANONICAL_CHECKS.URL_UNDEFINED.check,
Expand Down
2 changes: 1 addition & 1 deletion src/experimentation/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function hasNonWWWSubdomain(baseUrl) {
try {
const uri = new URI(baseUrl);
return hasText(uri.domain()) && hasText(uri.subdomain()) && uri.subdomain() !== 'www';
} catch (e) {
} catch {
throw new Error(`Cannot parse baseURL: ${baseUrl}`);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/support/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function hasNonWWWSubdomain(baseUrl) {
try {
const uri = new URI(baseUrl);
return hasText(uri.domain()) && hasText(uri.subdomain()) && uri.subdomain() !== 'www';
} catch (e) {
} catch {
throw new Error(`Cannot parse baseURL: ${baseUrl}`);
}
}
Expand Down Expand Up @@ -75,7 +75,7 @@ export function extractDomainAndProtocol(inputUrl) {
protocol: parsedUrl.protocol.slice(0, -1),
domain: parsedUrl.hostname,
};
} catch (error) {
} catch {
return null;
}
}
Expand Down
7 changes: 3 additions & 4 deletions test/audits/apex.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

/* eslint-env mocha */
import chai from 'chai';
import { expect, use } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import chaiAsPromised from 'chai-as-promised';
Expand All @@ -20,9 +20,8 @@ import { apexAuditRunner } from '../../src/apex/handler.js';
import { MockContextBuilder } from '../shared.js';
import { hasNonWWWSubdomain, toggleWWW } from '../../src/support/utils.js';

chai.use(sinonChai);
chai.use(chaiAsPromised);
const { expect } = chai;
use(sinonChai);
use(chaiAsPromised);

const message = {
type: 'apex',
Expand Down
7 changes: 3 additions & 4 deletions test/audits/backlinks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ import { createSiteTopPage } from '@adobe/spacecat-shared-data-access/src/models
import { createConfiguration } from '@adobe/spacecat-shared-data-access/src/models/configuration.js';
import { createOrganization } from '@adobe/spacecat-shared-data-access/src/models/organization.js';

import chai from 'chai';
import { expect, use } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import nock from 'nock';
import auditBrokenBacklinks from '../../src/backlinks/handler.js';

chai.use(sinonChai);
chai.use(chaiAsPromised);
const { expect } = chai;
use(sinonChai);
use(chaiAsPromised);

describe('Backlinks Tests', function () {
this.timeout(10000);
Expand Down
7 changes: 3 additions & 4 deletions test/audits/canonical.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/* eslint-env mocha */

import chai from 'chai';
import { expect, use } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
Expand All @@ -22,9 +22,8 @@ import {
validateCanonicalRecursively, canonicalAuditRunner, CANONICAL_CHECKS,
} from '../../src/canonical/handler.js';

chai.use(sinonChai);
chai.use(chaiAsPromised);
const { expect } = chai;
use(sinonChai);
use(chaiAsPromised);

describe('Canonical URL Tests', () => {
let log;
Expand Down
5 changes: 2 additions & 3 deletions test/audits/conversion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
*/

/* eslint-env mocha */
import chai from 'chai';
import { expect, use } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import nock from 'nock';
import { conversionAuditRunner } from '../../src/conversion/handler.js';
import { rumDashboardData, rumSourcesData, expectedConversionData } from '../fixtures/conversion-data.js';

chai.use(sinonChai);
const { expect } = chai;
use(sinonChai);

const DOMAIN_REQUEST_DEFAULT_PARAMS = {
interval: 7,
Expand Down
5 changes: 2 additions & 3 deletions test/audits/cwv.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/* eslint-env mocha */

import chai from 'chai';
import { expect, use } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import { Request } from '@adobe/fetch';
Expand All @@ -22,8 +22,7 @@ import { main } from '../../src/index.js';
import { getRUMUrl } from '../../src/support/utils.js';
import { expectedAuditResult, rumData } from '../fixtures/rum-data.js';

chai.use(sinonChai);
const { expect } = chai;
use(sinonChai);

const sandbox = sinon.createSandbox();
const DOMAIN_REQUEST_DEFAULT_PARAMS = {
Expand Down
5 changes: 2 additions & 3 deletions test/audits/experimentation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

/* eslint-env mocha */
import chai from 'chai';
import { expect, use } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import nock from 'nock';
Expand All @@ -24,8 +24,7 @@ import {
rumDataEmpty,
} from '../fixtures/experimentation-data.js';

chai.use(sinonChai);
const { expect } = chai;
use(sinonChai);

const DOMAIN_REQUEST_DEFAULT_PARAMS = {
interval: 7,
Expand Down
7 changes: 3 additions & 4 deletions test/audits/lhs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/* eslint-env mocha */

import chai from 'chai';
import { expect, use } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
Expand All @@ -27,9 +27,8 @@ import createLHSAuditRunner, {
} from '../../src/lhs/lib.js';
import { MockContextBuilder } from '../shared.js';

const { expect } = chai;
chai.use(sinonChai);
chai.use(chaiAsPromised);
use(sinonChai);
use(chaiAsPromised);

const message = {
type: 'lhs-mobile',
Expand Down
5 changes: 2 additions & 3 deletions test/audits/notfound.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@

/* eslint-env mocha */

import chai from 'chai';
import { expect, use } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import nock from 'nock';
import { audit404Runner } from '../../src/notfound/handler.js';
import { notFoundData } from '../fixtures/notfounddata.js';
import { MockContextBuilder } from '../shared.js';

chai.use(sinonChai);
const { expect } = chai;
use(sinonChai);

describe('404 Tests', () => {
const url = 'https://abc.com';
Expand Down
7 changes: 3 additions & 4 deletions test/audits/sitemap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
/* eslint-env mocha */

import chai from 'chai';
import { expect, use } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import nock from 'nock';
Expand All @@ -26,9 +26,8 @@ import {
import { extractDomainAndProtocol } from '../../src/support/utils.js';
import { MockContextBuilder } from '../shared.js';

chai.use(sinonChai);
chai.use(chaiAsPromised);
const { expect } = chai;
use(sinonChai);
use(chaiAsPromised);
const sandbox = sinon.createSandbox();

describe('Sitemap Audit', () => {
Expand Down
7 changes: 3 additions & 4 deletions test/common/audit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

/* eslint-env mocha */
import chai from 'chai';
import { expect, use } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import chaiAsPromised from 'chai-as-promised';
Expand All @@ -30,9 +30,8 @@ import { AuditBuilder } from '../../src/common/audit-builder.js';
import { MockContextBuilder } from '../shared.js';
import { getUrlWithoutPath } from '../../src/support/utils.js';

chai.use(sinonChai);
chai.use(chaiAsPromised);
const { expect } = chai;
use(sinonChai);
use(chaiAsPromised);

const baseURL = 'https://space.cat';
const message = {
Expand Down
5 changes: 2 additions & 3 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@

/* eslint-env mocha */

import chai from 'chai';
import { expect, use } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import { Request } from '@adobe/fetch';
import { main } from '../src/index.js';

chai.use(sinonChai);
const { expect } = chai;
use(sinonChai);

const sandbox = sinon.createSandbox();

Expand Down
8 changes: 3 additions & 5 deletions test/support/psi-client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@

/* eslint-env mocha */

import chai from 'chai';
import { expect, use } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import nock from 'nock';
import sinon from 'sinon';

import PSIClient from '../../src/support/psi-client.js';

chai.use(chaiAsPromised);

const { expect } = chai;
use(chaiAsPromised);

describe('PSIClient', () => {
let client;
Expand Down Expand Up @@ -104,7 +102,7 @@ describe('PSIClient', () => {
try {
await client.performPSICheck('testsite.com', 'mobile');
expect.fail('Should have thrown an error');
} catch (e) {
} catch {
expect(logMock.error.called).to.be.true;
}
});
Expand Down
Loading

0 comments on commit 16774c2

Please sign in to comment.