diff --git a/lib/modules/datasource/sbt-package/index.spec.ts b/lib/modules/datasource/sbt-package/index.spec.ts index 05e015d651994f9f58703098e3df6edfc3626289..620a7958f8a2a58318ac2cac2822bdb48bde23f6 100644 --- a/lib/modules/datasource/sbt-package/index.spec.ts +++ b/lib/modules/datasource/sbt-package/index.spec.ts @@ -1,6 +1,7 @@ import { getPkgReleases } from '..'; import { Fixtures } from '../../../../test/fixtures'; import * as httpMock from '../../../../test/http-mock'; +import { regEx } from '../../../util/regex'; import * as mavenVersioning from '../../versioning/maven'; import { MAVEN_REPO } from '../maven/common'; import { parseIndexDir } from './util'; @@ -8,12 +9,20 @@ import { SbtPackageDatasource } from '.'; describe('modules/datasource/sbt-package/index', () => { it('parses Maven index directory', () => { - expect(parseIndexDir(Fixtures.get(`maven-index.html`))).toMatchSnapshot(); + expect( + parseIndexDir( + Fixtures.get(`maven-index.html`), + (x) => !regEx(/^\.+/).test(x), + ), + ).toMatchSnapshot(); }); it('parses sbt index directory', () => { expect( - parseIndexDir(Fixtures.get(`sbt-plugins-index.html`)), + parseIndexDir( + Fixtures.get(`sbt-plugins-index.html`), + (x) => !regEx(/^\.+/).test(x), + ), ).toMatchSnapshot(); }); diff --git a/lib/modules/datasource/sbt-package/util.ts b/lib/modules/datasource/sbt-package/util.ts index b2d017972e4c4589d0e26c6cc72ca394c79c5749..7b567b714723272c989db3bad96a57878e3ffe27 100644 --- a/lib/modules/datasource/sbt-package/util.ts +++ b/lib/modules/datasource/sbt-package/util.ts @@ -1,12 +1,11 @@ import { coerceArray } from '../../../util/array'; -import { regEx } from '../../../util/regex'; import { compare } from '../../versioning/maven/compare'; const linkRegExp = /(?<=href=['"])[^'"]*(?=\/['"])/gi; export function parseIndexDir( content: string, - filterFn = (x: string): boolean => !regEx(/^\.+/).test(x), + filterFn: (x: string) => boolean, ): string[] { const unfiltered = coerceArray(content.match(linkRegExp)); return unfiltered.filter(filterFn); diff --git a/lib/modules/datasource/sbt-plugin/index.spec.ts b/lib/modules/datasource/sbt-plugin/index.spec.ts index 6387ff45e60a0e2658c18cee423f9306e2ff5bb6..8b0d53481d7e654ef85c0dbc17717a1ee507c77f 100644 --- a/lib/modules/datasource/sbt-plugin/index.spec.ts +++ b/lib/modules/datasource/sbt-plugin/index.spec.ts @@ -2,6 +2,7 @@ import { codeBlock, html } from 'common-tags'; import { getPkgReleases } from '..'; import { Fixtures } from '../../../../test/fixtures'; import * as httpMock from '../../../../test/http-mock'; +import { regEx } from '../../../util/regex'; import * as mavenVersioning from '../../versioning/maven'; import { MAVEN_REPO } from '../maven/common'; import { parseIndexDir } from '../sbt-package/util'; @@ -12,11 +13,15 @@ const sbtPluginIndex = Fixtures.get(`sbt-plugins-index.html`); describe('modules/datasource/sbt-plugin/index', () => { it('parses Maven index directory', () => { - expect(parseIndexDir(mavenIndexHtml)).toMatchSnapshot(); + expect( + parseIndexDir(mavenIndexHtml, (x) => !regEx(/^\.+/).test(x)), + ).toMatchSnapshot(); }); it('parses sbt index directory', () => { - expect(parseIndexDir(sbtPluginIndex)).toMatchSnapshot(); + expect( + parseIndexDir(sbtPluginIndex, (x) => !regEx(/^\.+/).test(x)), + ).toMatchSnapshot(); }); it('uses proper hostType', () => {