From b10be239577842c61d7deedadfa162212df69aad Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Fri, 23 Apr 2021 12:12:39 +0300 Subject: [PATCH] Fix loadJsonFixture --- lib/config/presets/index.spec.ts | 5 ++++- lib/datasource/dart/index.spec.ts | 2 +- lib/datasource/gradle-version/index.spec.ts | 2 +- lib/datasource/hex/index.spec.ts | 2 +- lib/datasource/jenkins-plugins/index.spec.ts | 10 +++++++-- lib/datasource/packagist/index.spec.ts | 6 ++--- lib/datasource/rubygems/index.spec.ts | 4 ++-- .../locked-dependency/dep-constraints.spec.ts | 4 ++-- .../locked-dependency/get-locked.spec.ts | 2 +- .../locked-dependency/parent-version.spec.ts | 2 +- .../repository/process/lookup/index.spec.ts | 22 +++++++++++++------ 11 files changed, 39 insertions(+), 22 deletions(-) diff --git a/lib/config/presets/index.spec.ts b/lib/config/presets/index.spec.ts index 87ea2bb424e0a0..38e7e4f982ad51 100644 --- a/lib/config/presets/index.spec.ts +++ b/lib/config/presets/index.spec.ts @@ -16,7 +16,10 @@ jest.mock('./local'); const npm = mocked(_npm); const local = mocked(_local); -const presetIkatyang = loadJsonFixture('renovate-config-ikatyang.json'); +const presetIkatyang = loadJsonFixture( + __filename, + 'renovate-config-ikatyang.json' +); npm.getPreset = jest.fn(({ packageName, presetName }) => { if (packageName === 'renovate-config-ikatyang') { diff --git a/lib/datasource/dart/index.spec.ts b/lib/datasource/dart/index.spec.ts index 517230911f9094..abc986a028b1bc 100644 --- a/lib/datasource/dart/index.spec.ts +++ b/lib/datasource/dart/index.spec.ts @@ -3,7 +3,7 @@ import * as httpMock from '../../../test/http-mock'; import { getName, loadJsonFixture } from '../../../test/util'; import { id as datasource } from '.'; -const body = loadJsonFixture('shared_preferences.json'); +const body = loadJsonFixture(__filename, 'shared_preferences.json'); const baseUrl = 'https://pub.dartlang.org/api/packages/'; diff --git a/lib/datasource/gradle-version/index.spec.ts b/lib/datasource/gradle-version/index.spec.ts index db980268c852d9..dd527dc0e1396f 100644 --- a/lib/datasource/gradle-version/index.spec.ts +++ b/lib/datasource/gradle-version/index.spec.ts @@ -5,7 +5,7 @@ import { ExternalHostError } from '../../types/errors/external-host-error'; import { id as versioning } from '../../versioning/gradle'; import { id as datasource, getReleases } from '.'; -const allResponse: any = loadJsonFixture('all.json'); +const allResponse: any = loadJsonFixture(__filename, 'all.json'); let config: GetPkgReleasesConfig; diff --git a/lib/datasource/hex/index.spec.ts b/lib/datasource/hex/index.spec.ts index 95aa9da02b1250..4357cf966fe18c 100644 --- a/lib/datasource/hex/index.spec.ts +++ b/lib/datasource/hex/index.spec.ts @@ -7,7 +7,7 @@ import { id as datasource } from '.'; const hostRules: any = _hostRules; -const res1 = loadJsonFixture('certifi.json'); +const res1 = loadJsonFixture(__filename, 'certifi.json'); jest.mock('../../util/host-rules'); diff --git a/lib/datasource/jenkins-plugins/index.spec.ts b/lib/datasource/jenkins-plugins/index.spec.ts index e1f696c48f9216..3943760e88860d 100644 --- a/lib/datasource/jenkins-plugins/index.spec.ts +++ b/lib/datasource/jenkins-plugins/index.spec.ts @@ -5,8 +5,14 @@ import * as versioning from '../../versioning/docker'; import { resetCache } from './get'; import * as jenkins from '.'; -const jenkinsPluginsVersions = loadJsonFixture('plugin-versions.json'); -const jenkinsPluginsInfo = loadJsonFixture('update-center.actual.json'); +const jenkinsPluginsVersions = loadJsonFixture( + __filename, + 'plugin-versions.json' +); +const jenkinsPluginsInfo = loadJsonFixture( + __filename, + 'update-center.actual.json' +); describe(getName(__filename), () => { describe('getReleases', () => { diff --git a/lib/datasource/packagist/index.spec.ts b/lib/datasource/packagist/index.spec.ts index 70a4c84fd6aab1..556339f47b8b59 100644 --- a/lib/datasource/packagist/index.spec.ts +++ b/lib/datasource/packagist/index.spec.ts @@ -10,9 +10,9 @@ jest.mock('../../util/host-rules'); const hostRules = _hostRules; -const includesJson: any = loadJsonFixture('includes.json'); -const beytJson: any = loadJsonFixture('1beyt.json'); -const mailchimpJson: any = loadJsonFixture('mailchimp-api.json'); +const includesJson: any = loadJsonFixture(__filename, 'includes.json'); +const beytJson: any = loadJsonFixture(__filename, '1beyt.json'); +const mailchimpJson: any = loadJsonFixture(__filename, 'mailchimp-api.json'); const baseUrl = 'https://packagist.org'; diff --git a/lib/datasource/rubygems/index.spec.ts b/lib/datasource/rubygems/index.spec.ts index 6a7f238e6243ee..92df66b559aba3 100644 --- a/lib/datasource/rubygems/index.spec.ts +++ b/lib/datasource/rubygems/index.spec.ts @@ -6,8 +6,8 @@ import { resetCache } from './get-rubygems-org'; import * as rubygems from '.'; const rubygemsOrgVersions = loadFixture(__filename, 'rubygems-org.txt'); -const railsInfo = loadJsonFixture('rails/info.json'); -const railsVersions = loadJsonFixture('rails/versions.json'); +const railsInfo = loadJsonFixture(__filename, 'rails/info.json'); +const railsVersions = loadJsonFixture(__filename, 'rails/versions.json'); describe(getName(__filename), () => { describe('getReleases', () => { diff --git a/lib/manager/npm/update/locked-dependency/dep-constraints.spec.ts b/lib/manager/npm/update/locked-dependency/dep-constraints.spec.ts index a35f88670be89e..577b9317221bf9 100644 --- a/lib/manager/npm/update/locked-dependency/dep-constraints.spec.ts +++ b/lib/manager/npm/update/locked-dependency/dep-constraints.spec.ts @@ -3,8 +3,8 @@ import { findDepConstraints } from './dep-constraints'; jest.mock('../../../../util/fs'); -const packageJson = loadJsonFixture('package.json'); -const packageLockJson = loadJsonFixture('package-lock.json'); +const packageJson = loadJsonFixture(__filename, 'package.json'); +const packageLockJson = loadJsonFixture(__filename, 'package-lock.json'); describe(getName(__filename), () => { describe('findDepConstraints()', () => { diff --git a/lib/manager/npm/update/locked-dependency/get-locked.spec.ts b/lib/manager/npm/update/locked-dependency/get-locked.spec.ts index a1d34394d1862f..80370af9e543ac 100644 --- a/lib/manager/npm/update/locked-dependency/get-locked.spec.ts +++ b/lib/manager/npm/update/locked-dependency/get-locked.spec.ts @@ -3,7 +3,7 @@ import { getLockedDependencies } from './get-locked'; jest.mock('../../../../util/fs'); -const packageLockJson = loadJsonFixture('package-lock.json'); +const packageLockJson = loadJsonFixture(__filename, 'package-lock.json'); describe(getName(__filename), () => { describe('getLockedDependencies()', () => { diff --git a/lib/manager/npm/update/locked-dependency/parent-version.spec.ts b/lib/manager/npm/update/locked-dependency/parent-version.spec.ts index 9ce440686e3f64..0e5717c181a216 100644 --- a/lib/manager/npm/update/locked-dependency/parent-version.spec.ts +++ b/lib/manager/npm/update/locked-dependency/parent-version.spec.ts @@ -2,7 +2,7 @@ import * as httpMock from '../../../../../test/http-mock'; import { getName, loadJsonFixture } from '../../../../../test/util'; import { findFirstParentVersion } from './parent-version'; -const expressJson = loadJsonFixture('express.json'); +const expressJson = loadJsonFixture(__filename, 'express.json'); describe(getName(__filename), () => { describe('getLockedDependencies()', () => { diff --git a/lib/workers/repository/process/lookup/index.spec.ts b/lib/workers/repository/process/lookup/index.spec.ts index fca1392d091497..d457c3a565ee53 100644 --- a/lib/workers/repository/process/lookup/index.spec.ts +++ b/lib/workers/repository/process/lookup/index.spec.ts @@ -30,15 +30,23 @@ jest.mock('../../../../datasource/github-releases'); const fixtureRoot = '../../../../config/npm'; const qJson = { - ...loadJsonFixture('01.json', fixtureRoot), + ...loadJsonFixture(__filename, '01.json', fixtureRoot), latestVersion: '1.4.1', }; -const helmetJson = loadJsonFixture('02.json', fixtureRoot); -const coffeelintJson = loadJsonFixture('coffeelint.json', fixtureRoot); -const nextJson = loadJsonFixture('next.json', fixtureRoot); -const typescriptJson = loadJsonFixture('typescript.json', fixtureRoot); -const vueJson = loadJsonFixture('vue.json', fixtureRoot); -const webpackJson = loadJsonFixture('webpack.json', fixtureRoot); +const helmetJson = loadJsonFixture(__filename, '02.json', fixtureRoot); +const coffeelintJson = loadJsonFixture( + __filename, + 'coffeelint.json', + fixtureRoot +); +const nextJson = loadJsonFixture(__filename, 'next.json', fixtureRoot); +const typescriptJson = loadJsonFixture( + __filename, + 'typescript.json', + fixtureRoot +); +const vueJson = loadJsonFixture(__filename, 'vue.json', fixtureRoot); +const webpackJson = loadJsonFixture(__filename, 'webpack.json', fixtureRoot); const docker = mocked(datasourceDocker) as any; docker.defaultRegistryUrls = ['https://index.docker.io'];