test: migrate to vitest (#34475)

Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
pull/34488/head^2
Michael Kriese 2025-02-26 10:35:54 +01:00 committed by GitHub
parent 231552340b
commit 997c23502e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
419 changed files with 4214 additions and 2455 deletions

View File

@ -20,7 +20,7 @@
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"orta.vscode-jest",
"vitest.explorer",
"editorconfig.editorconfig",
"github.vscode-github-actions"
]

View File

@ -44,31 +44,31 @@ Use these commands to help run your tests:
- To run a single test folder, specify the path
```bash
pnpm jest platform/gitlab
pnpm vitest platform/gitlab
```
- To run against a single test file, specify down to the filename (suffix is not necessary)
```bash
pnpm jest platform/gitlab/index
pnpm vitest platform/gitlab/index
```
- To run a single test batch, the `-t` value must be part of the `describe` value of the test batch
```bash
pnpm jest platform/gitlab/index -t "getJsonFile"
pnpm vitest platform/gitlab/index -t "getJsonFile"
```
- To run a single test, the `-t` value must be part of the `it` value of the test batch
```bash
pnpm jest platform/gitlab/index -t "returns file content from given repo"
pnpm vitest platform/gitlab/index -t "returns file content from given repo"
```
And some options:
- `--verbose=false` to avoid the test list
- `--collectCoverage=false` to avoid collecting coverage, faster for the part you need the test to pass
- `--coverage=false` to avoid collecting coverage, faster for the part you need the test to pass
## Do not force push to your pull request branch

View File

@ -247,7 +247,7 @@
Hi there,
You're skipping code tests with `istanbul ignore`.
You're skipping code tests with `v8 ignore`.
Please only skip tests if:
@ -260,7 +260,7 @@
```ts
// istanbul ignore next: typescript strict null check
// v8 ignore next: typescript strict null check
if (!url) {
return null;
}

View File

@ -378,12 +378,12 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
os: ${{ runner.os }}
- name: Cache jest
- name: Cache vitest
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
with:
path: .cache/jest
path: .cache/vitest
key: |
jest-cache-${{
vitest-cache-${{
runner.os
}}-${{
env.NODE_VERSION
@ -398,8 +398,7 @@ jobs:
run: |
for shard in ${{ matrix.shards }};
do
TEST_SHARD="$shard" pnpm jest \
--ci \
TEST_SHARD="$shard" pnpm vitest \
--test-timeout ${{ matrix.test-timeout-milliseconds }} \
--coverage ${{ matrix.coverage }}
done
@ -488,10 +487,10 @@ jobs:
- name: Check coverage threshold
run: |
pnpm nyc check-coverage -t ./coverage/nyc \
--branches 100 \
--functions 100 \
--lines 100 \
--statements 100
--branches 97 \
--functions 98 \
--lines 97 \
--statements 97
# Catch-all required check for test matrix and coverage
test-success:

View File

@ -15,7 +15,7 @@ ignore:
- .venv
- CODE_OF_CONDUCT.md
- dist
- jest.config.ts
- vitest.config.ts
- node_modules
- SECURITY.md
- test/e2e/node_modules

View File

@ -2,7 +2,7 @@
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"orta.vscode-jest",
"vitest.explorer",
"editorconfig.editorconfig",
"github.vscode-github-actions"
]

82
.vscode/launch.json vendored
View File

@ -29,84 +29,22 @@
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"runtimeExecutable": "pnpm",
"program": "jest",
"name": "Debug Current Test File",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": [
"--runInBand",
"--collectCoverage=false",
"--testTimeout=100000000",
"--runTestsByPath",
"run",
"--no-file-parallelism",
"--no-coverage",
"--test-timeout=0",
"--hook-timeout=0",
"${relativeFile}"
],
"env": {
"NODE_ENV": "test",
"LOG_LEVEL": "debug"
},
"console": "integratedTerminal",
"runtimeArgs": ["--preserve-symlinks"],
"skipFiles": ["<node_internals>/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "Jest All",
"runtimeExecutable": "pnpm",
"program": "jest",
"args": [
"--runInBand",
"--collectCoverage=false",
"--testTimeout=100000000"
],
"env": {
"NODE_ENV": "test",
"LOG_LEVEL": "debug"
},
"console": "integratedTerminal",
"runtimeArgs": ["--preserve-symlinks"],
"skipFiles": ["<node_internals>/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "Jest Current Folder",
"runtimeExecutable": "pnpm",
"program": "jest",
"args": [
"--runInBand",
"--collectCoverage=false",
"--testTimeout=100000000",
"--roots=${workspaceFolder}/${relativeFileDirname}"
],
"console": "integratedTerminal",
"runtimeArgs": ["--preserve-symlinks"],
"skipFiles": ["<node_internals>/**/*.js"]
},
{
"type": "node",
"name": "vscode-jest-tests.v2",
"request": "launch",
"console": "integratedTerminal",
"internalConsoleOptions": "openOnSessionStart",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "node",
"runtimeArgs": ["--experimental-vm-modules"],
"program": "node_modules/jest/bin/jest.js",
"args": [
"--runInBand",
"--watchAll=false",
"--testTimeout=100000000",
"--coverage=false",
"--runTestsByPath",
"${jest.testFile}",
"--testNamePattern",
"${jest.testNamePattern}"
],
"env": {
"NODE_ENV": "test",
"LOG_LEVEL": "trace",
"GIT_ALLOW_PROTOCOL": "file"
}
"console": "integratedTerminal"
}
]
}

View File

@ -16,10 +16,7 @@
".releaserc": "json"
},
"omnisharp.autoStart": false,
"jest.runMode": "on-demand",
"jest.jestCommandLine": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"jest.nodeEnv": {
"NODE_ENV": "test",
"vitest.nodeEnv": {
"LOG_LEVEL": "trace",
"GIT_ALLOW_PROTOCOL": "file"
},

View File

@ -13,7 +13,7 @@ Some good branch names:
- `feat/13732-cacache-cleanup`
- `fix/15431-gitea-automerge-strategy`
- `refactor/jest-reset-mocks`
- `refactor/vitest-reset-mocks`
- `docs/rewrite-packageRules-section`
Avoid branch names like `patch-1`.
@ -29,14 +29,14 @@ Read the [GitHub Docs, renaming a branch](https://docs.github.com/en/repositorie
- Prefer `interface` over `type` for TypeScript type declarations
- Avoid [Enums](https://github.com/renovatebot/renovate/issues/13743), use unions or [immutable objects](https://github.com/renovatebot/renovate/blob/5043379847818ac1fa71ff69c098451975e95710/lib/modules/versioning/pep440/range.ts#L8-L20) instead
- Always add unit tests for full code coverage
- Only use `istanbul` comments for unreachable code coverage that is needed for `codecov` completion
- Use descriptive `istanbul` comments
- Only use `v8` comments for unreachable code coverage that is needed for `codecov` completion
- Use descriptive `v8` comments
- Avoid cast or prefer `x as T` instead of `<T>x` cast
- Prefer `satisfies` operator over `as`, read the [TypeScript release notes for `satisfies` operator](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator) to learn more
- Avoid `Boolean` instead use `is` functions from `@sindresorhus/is` package, for example: `is.string`
```ts
// istanbul ignore next: can never happen
// v8 ignore next: can never happen
```
### Functions
@ -280,12 +280,12 @@ if (end) {
- Separate the _Arrange_, _Act_ and _Assert_ phases with newlines
- Use `it.each` rather than `test.each`
- Prefer [Tagged Template Literal](https://jestjs.io/docs/api#2-testeachtablename-fn-timeout) style for `it.each`, Prettier will help with formatting
- Prefer [Tagged Template Literal](https://vitest.dev/api/#test-each) style for `it.each`, Prettier will help with formatting
- See [Example](https://github.com/renovatebot/renovate/blob/768e178419437a98f5ce4996bafd23f169e530b4/lib/modules/platform/util.spec.ts#L8-L18)
- Mock Date/Time when testing a Date/Time dependent module
- For `Luxon` mocking see [Example](https://github.com/renovatebot/renovate/blob/5043379847818ac1fa71ff69c098451975e95710/lib/modules/versioning/distro.spec.ts#L7-L10)
- Prefer `jest.spyOn` for mocking single functions, or mock entire modules
- Avoid overwriting functions, for example: (`func = jest.fn();`)
- Prefer `vi.spyOn` for mocking single functions, or mock entire modules
- Avoid overwriting functions, for example: (`func = vi.fn();`)
- Prefer `toEqual`
- Use `toMatchObject` for huge objects when only parts need to be tested
- Avoid `toMatchSnapshot`, only use it for:

View File

@ -203,7 +203,7 @@ Add a label `auto:logs` to indicate that there's a problem with the logs, and th
Add a label `auto:needs-details` to discussions which need more details to move forward.
Add a label `auto:no-coverage-ignore` if PR authors avoid needed unit tests by istanbul ignoring code with the `// istanbul ignore` comment.
Add a label `auto:no-coverage-ignore` if PR authors avoid needed unit tests by v8 ignoring code with the `// v8 ignore` comment.
Add a label `auto:no-done-comments` if PR authors unnecessary "Done" comments, or type comments to ask for a review instead of requesting a new review through GitHub's UI.

View File

@ -144,21 +144,21 @@ If this is working then in future you can create other test repos to verify your
You can run `pnpm test` locally to test your code.
We test all PRs using the same tests, run on GitHub Actions.
`pnpm test` runs an `eslint` check, a `prettier` check, a `type` check and then all the unit tests using `jest`.
`pnpm test` runs an `eslint` check, a `prettier` check, a `type` check and then all the unit tests using `vitest`.
Refactor PRs should ideally not change or remove tests (adding tests is OK).
### Jest
### Vitest
Run the Jest unit tests with the `pnpm jest` command.
You can also run a subset of the Jest tests using file matching, e.g. `pnpm jest composer` or `pnpm jest workers/repository/update/branch`.
Run the Vitest unit tests with the `pnpm vitest` command.
You can also run a subset of the Vitest tests using file matching, e.g. `pnpm vitest composer` or `pnpm vitest workers/repository/update/branch`.
If you get a test failure due to a "snapshot" mismatch, and you are sure that you need to update the snapshot, then you can append `-u` to the end.
e.g. `pnpm jest composer -u` would update the saved snapshots for _all_ tests in `**/composer/**`.
e.g. `pnpm vitest composer -u` would update the saved snapshots for _all_ tests in `**/composer/**`.
### Coverage
The Renovate project maintains 100% test coverage, so any Pull Request will fail if it does not have full coverage for code.
Using `// istanbul ignore` is not ideal, but can be a pragmatic solution if adding more tests wouldn't really prove anything.
Using `// v8 ignore` is not ideal, but can be a pragmatic solution if adding more tests wouldn't really prove anything.
To view the current test coverage locally, open up `coverage/index.html` in your browser.

View File

@ -2,7 +2,7 @@ import eslintContainerbase from '@containerbase/eslint-plugin';
import js from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginImport from 'eslint-plugin-import';
import jest from 'eslint-plugin-jest';
import vitest from '@vitest/eslint-plugin';
import eslintPluginPromise from 'eslint-plugin-promise';
import globals from 'globals';
import tseslint from 'typescript-eslint';
@ -40,7 +40,6 @@ export default tseslint.config(
eslintPluginImport.flatConfigs.warnings,
eslintPluginImport.flatConfigs.recommended,
eslintPluginImport.flatConfigs.typescript,
jest.configs['flat/recommended'],
eslintPluginPromise.configs['flat/recommended'],
eslintContainerbase.configs.all,
{
@ -88,7 +87,12 @@ export default tseslint.config(
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['eslint.config.mjs', 'test/**/*', '**/*.spec.ts'],
devDependencies: [
'*.config.mjs',
'*.config.ts',
'test/**/*',
'**/*.spec.ts',
],
},
],
@ -114,7 +118,7 @@ export default tseslint.config(
'import/no-unresolved': [
'error',
{
ignore: ['^mdast$'],
ignore: ['^mdast$', `^jest-mock-extended$`],
},
],
@ -227,13 +231,22 @@ export default tseslint.config(
{
files: ['**/*.spec.ts', 'test/**'],
plugins: { vitest },
languageOptions: {
globals: {
...globals.jest,
...globals.vitest,
},
},
settings: {
vitest: {
typecheck: true,
},
},
rules: {
...vitest.configs.recommended.rules,
'no-template-curly-in-string': 0,
'prefer-destructuring': 0,
'prefer-promise-reject-errors': 0,
@ -243,14 +256,6 @@ export default tseslint.config(
'@typescript-eslint/no-object-literal-type-assertion': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/unbound-method': 0,
'jest/valid-title': [
0,
{
ignoreTypeOfDescribeName: true,
},
],
'max-classes-per-file': 0,
'class-methods-use-this': 0,
},
@ -304,7 +309,7 @@ export default tseslint.config(
languageOptions: {
globals: {
...Object.fromEntries(
Object.entries(globals.jest).map(([key]) => [key, 'off']),
Object.entries(globals.vitest).map(([key]) => [key, 'off']),
),
},
},

View File

@ -1,147 +0,0 @@
import os from 'node:os';
import v8 from 'node:v8';
import { testShards } from './tools/test/shards';
import type { JestConfig, JestShardedSubconfig } from './tools/test/types';
import { getCoverageIgnorePatterns } from './tools/test/utils';
const ci = !!process.env.CI;
const cpus = os.cpus();
const mem = os.totalmem();
const stats = v8.getHeapStatistics();
/**
* https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
* Currently it seems the runner only have 4GB
*/
function jestGithubRunnerSpecs(): JestConfig {
// if (os.platform() === 'darwin') {
// return {
// maxWorkers: 2,
// workerIdleMemoryLimit: '4GB',
// };
// }
return {
maxWorkers: cpus.length,
workerIdleMemoryLimit: '1500MB', // '2GB',
};
}
/**
* Convert match pattern to a form that matches on file with `.ts` or `.spec.ts` extension.
*/
function normalizePattern(pattern: string, suffix: '.ts' | '.spec.ts'): string {
return pattern.endsWith('.spec.ts')
? pattern.replace(/\.spec\.ts$/, suffix)
: `${pattern}/**/*${suffix}`;
}
/**
* Generates Jest config for sharded test run.
*
* If `TEST_SHARD` environment variable is not set,
* it falls back to the provided config.
*
* Otherwise, `fallback` value is used to determine some defaults.
*/
function configureShardingOrFallbackTo(
fallback: JestShardedSubconfig,
): JestShardedSubconfig {
const shardKey = process.env.TEST_SHARD;
if (!shardKey) {
return fallback;
}
if (!testShards[shardKey]) {
const keys = Object.keys(testShards).join(', ');
throw new Error(
`Unknown value for TEST_SHARD: ${shardKey} (possible values: ${keys})`,
);
}
const testMatch: string[] = [];
for (const [key, { matchPaths: patterns }] of Object.entries(testShards)) {
if (key === shardKey) {
const testMatchPatterns = patterns.map((pattern) => {
const filePattern = normalizePattern(pattern, '.spec.ts');
return `<rootDir>/${filePattern}`;
});
testMatch.push(...testMatchPatterns);
break;
}
const testMatchPatterns = patterns.map((pattern) => {
const filePattern = normalizePattern(pattern, '.spec.ts');
return `!**/${filePattern}`;
});
testMatch.push(...testMatchPatterns);
}
testMatch.reverse();
const coverageDirectory = `./coverage/shard/${shardKey}`;
return {
testMatch,
coverageDirectory,
};
}
const config: JestConfig = {
...configureShardingOrFallbackTo({
coverageDirectory: './coverage',
}),
collectCoverageFrom: [
'lib/**/*.{js,ts}',
'!lib/**/*.{d,spec}.ts',
'!lib/**/{__fixtures__,__mocks__,__testutil__,test}/**/*.{js,ts}',
'!lib/**/types.ts',
],
coveragePathIgnorePatterns: getCoverageIgnorePatterns(),
cacheDirectory: '.cache/jest',
collectCoverage: true,
coverageReporters: ci
? ['lcovonly', 'json']
: ['html', 'text-summary', 'json'],
transform: {
'\\.ts$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
diagnostics: false,
isolatedModules: true,
},
],
},
modulePathIgnorePatterns: [
'<rootDir>/dist/',
'/__fixtures__/',
'/__mocks__/',
],
reporters: ci ? ['default', 'github-actions'] : ['default'],
resetMocks: true,
globalSetup: '<rootDir>/test/global-setup.ts',
setupFilesAfterEnv: [
'jest-extended/all',
'expect-more-jest',
'<rootDir>/test/setup.ts',
'<rootDir>/test/to-migrate.ts',
],
snapshotSerializers: ['<rootDir>/test/newline-snapshot-serializer.ts'],
testEnvironment: 'node',
testRunner: 'jest-circus/runner',
watchPathIgnorePatterns: ['<rootDir>/.cache/', '<rootDir>/coverage/'],
// We can play with that value later for best dev experience
workerIdleMemoryLimit: '500MB',
// add github runner specific limits
...(ci && jestGithubRunnerSpecs()),
};
export default config;
process.stderr.write(`Host stats:
Cpus: ${cpus.length}
Memory: ${(mem / 1024 / 1024 / 1024).toFixed(2)} GB
HeapLimit: ${(stats.heap_size_limit / 1024 / 1024 / 1024).toFixed(2)} GB
`);

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`config/index mergeChildConfig(parentConfig, childConfig) merges 1`] = `
exports[`config/index > mergeChildConfig(parentConfig, childConfig) > merges 1`] = `
{
"branchTopic": "lock-file-maintenance",
"commitMessageAction": "Lock file maintenance",
@ -19,7 +19,7 @@ exports[`config/index mergeChildConfig(parentConfig, childConfig) merges 1`] = `
}
`;
exports[`config/index mergeChildConfig(parentConfig, childConfig) merges constraints 1`] = `
exports[`config/index > mergeChildConfig(parentConfig, childConfig) > merges constraints 1`] = `
{
"node": "<15",
"npm": "^6.0.0",

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`config/migrate-validate migrateAndValidate() handles invalid 1`] = `
exports[`config/migrate-validate > migrateAndValidate() > handles invalid 1`] = `
{
"errors": [
{
@ -13,7 +13,7 @@ exports[`config/migrate-validate migrateAndValidate() handles invalid 1`] = `
}
`;
exports[`config/migrate-validate migrateAndValidate() isOnboarded 1`] = `
exports[`config/migrate-validate > migrateAndValidate() > isOnboarded 1`] = `
{
"errors": [],
}

View File

@ -1,89 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`config/migration it migrates customManagers 1`] = `
{
"customManagers": [
{
"customType": "regex",
"fileMatch": [
"(^|/|\\.)Dockerfile$",
"(^|/)Dockerfile[^/]*$",
],
"matchStrings": [
"# renovate: datasource=(?<datasource>[a-z-]+?) depName=(?<depName>[^\\s]+?)(?: lookupName=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[a-z-0-9]+?))?\\s(?:ENV|ARG) .+?_VERSION="?(?<currentValue>.+?)"?\\s",
],
},
{
"customType": "regex",
"fileMatch": [
"(^|/|\\.)Dockerfile$",
"(^|/)Dockerfile[^/]*$",
],
"matchStrings": [
"# renovate: datasource=(?<datasource>[a-z-]+?) depName=(?<depName>[^\\s]+?)(?: lookupName=(?<holder>[^\\s]+?))?(?: versioning=(?<versioning>[a-z-0-9]+?))?\\s(?:ENV|ARG) .+?_VERSION="?(?<currentValue>.+?)"?\\s",
],
"packageNameTemplate": "{{{holder}}}",
},
],
}
`;
exports[`config/migration it migrates gradle-lite 1`] = `
{
"gradle": {
"enabled": true,
"fileMatch": [
"foo",
],
},
"packageRules": [
{
"matchManagers": [
"gradle",
],
"separateMinorPatch": true,
},
],
}
`;
exports[`config/migration it migrates nested packageRules 1`] = `
{
"packageRules": [
{
"enabled": false,
"matchDepTypes": [
"devDependencies",
],
},
{
"automerge": true,
"groupName": "definitelyTyped",
"matchPackageNames": [
"!@types/react-table",
"@types/**",
],
},
{
"automerge": false,
"matchDepTypes": [
"dependencies",
],
"matchPackageNames": [
"!@types/react-table",
],
},
],
}
`;
exports[`config/migration migrateConfig(config, parentConfig) does not migrate multi days 1`] = `
exports[`config/migration > migrateConfig(config, parentConfig) > does not migrate multi days 1`] = `
{
"schedule": "after 5:00pm on wednesday and thursday",
}
`;
exports[`config/migration migrateConfig(config, parentConfig) migrates before and after schedules 1`] = `
exports[`config/migration > migrateConfig(config, parentConfig) > migrates before and after schedules 1`] = `
{
"major": {
"schedule": [
@ -100,7 +23,7 @@ exports[`config/migration migrateConfig(config, parentConfig) migrates before an
}
`;
exports[`config/migration migrateConfig(config, parentConfig) migrates config 1`] = `
exports[`config/migration > migrateConfig(config, parentConfig) > migrates config 1`] = `
{
"additionalBranchPrefix": "{{parentDir}}-",
"allowCustomCrateRegistries": true,
@ -297,7 +220,7 @@ exports[`config/migration migrateConfig(config, parentConfig) migrates config 1`
}
`;
exports[`config/migration migrateConfig(config, parentConfig) migrates more packageFiles 1`] = `
exports[`config/migration > migrateConfig(config, parentConfig) > migrates more packageFiles 1`] = `
{
"includePaths": [
"package.json",
@ -325,7 +248,7 @@ exports[`config/migration migrateConfig(config, parentConfig) migrates more pack
}
`;
exports[`config/migration migrateConfig(config, parentConfig) migrates packageFiles 1`] = `
exports[`config/migration > migrateConfig(config, parentConfig) > migrates packageFiles 1`] = `
{
"includePaths": [
"package.json",
@ -368,7 +291,7 @@ exports[`config/migration migrateConfig(config, parentConfig) migrates packageFi
}
`;
exports[`config/migration migrateConfig(config, parentConfig) migrates subconfig 1`] = `
exports[`config/migration > migrateConfig(config, parentConfig) > migrates subconfig 1`] = `
{
"lockFileMaintenance": {
"packageRules": [
@ -383,7 +306,7 @@ exports[`config/migration migrateConfig(config, parentConfig) migrates subconfig
}
`;
exports[`config/migration migrateConfig(config, parentConfig) overrides existing automerge setting 1`] = `
exports[`config/migration > migrateConfig(config, parentConfig) > overrides existing automerge setting 1`] = `
{
"major": {
"automerge": false,
@ -409,3 +332,80 @@ exports[`config/migration migrateConfig(config, parentConfig) overrides existing
],
}
`;
exports[`config/migration > migrates customManagers 1`] = `
{
"customManagers": [
{
"customType": "regex",
"fileMatch": [
"(^|/|\\.)Dockerfile$",
"(^|/)Dockerfile[^/]*$",
],
"matchStrings": [
"# renovate: datasource=(?<datasource>[a-z-]+?) depName=(?<depName>[^\\s]+?)(?: lookupName=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[a-z-0-9]+?))?\\s(?:ENV|ARG) .+?_VERSION="?(?<currentValue>.+?)"?\\s",
],
},
{
"customType": "regex",
"fileMatch": [
"(^|/|\\.)Dockerfile$",
"(^|/)Dockerfile[^/]*$",
],
"matchStrings": [
"# renovate: datasource=(?<datasource>[a-z-]+?) depName=(?<depName>[^\\s]+?)(?: lookupName=(?<holder>[^\\s]+?))?(?: versioning=(?<versioning>[a-z-0-9]+?))?\\s(?:ENV|ARG) .+?_VERSION="?(?<currentValue>.+?)"?\\s",
],
"packageNameTemplate": "{{{holder}}}",
},
],
}
`;
exports[`config/migration > migrates gradle-lite 1`] = `
{
"gradle": {
"enabled": true,
"fileMatch": [
"foo",
],
},
"packageRules": [
{
"matchManagers": [
"gradle",
],
"separateMinorPatch": true,
},
],
}
`;
exports[`config/migration > migrates nested packageRules 1`] = `
{
"packageRules": [
{
"enabled": false,
"matchDepTypes": [
"devDependencies",
],
},
{
"automerge": true,
"groupName": "definitelyTyped",
"matchPackageNames": [
"!@types/react-table",
"@types/**",
],
},
{
"automerge": false,
"matchDepTypes": [
"dependencies",
],
"matchPackageNames": [
"!@types/react-table",
],
},
],
}
`;

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`config/validation validateConfig(config) catches invalid allowedVersions regex 1`] = `
exports[`config/validation > validateConfig(config) > catches invalid allowedVersions regex 1`] = `
[
{
"message": "Invalid regExp for packageRules[1].allowedVersions: \`/***$}{]][/\`",
@ -13,7 +13,7 @@ exports[`config/validation validateConfig(config) catches invalid allowedVersion
]
`;
exports[`config/validation validateConfig(config) catches invalid matchCurrentVersion regex 1`] = `
exports[`config/validation > validateConfig(config) > catches invalid matchCurrentVersion regex 1`] = `
[
{
"message": "Invalid regExp for packageRules[1].matchCurrentVersion: \`/***$}{]][/\`",
@ -26,7 +26,7 @@ exports[`config/validation validateConfig(config) catches invalid matchCurrentVe
]
`;
exports[`config/validation validateConfig(config) catches invalid templates 1`] = `
exports[`config/validation > validateConfig(config) > catches invalid templates 1`] = `
[
{
"message": "Invalid template in config path: commitMessage",
@ -35,7 +35,7 @@ exports[`config/validation validateConfig(config) catches invalid templates 1`]
]
`;
exports[`config/validation validateConfig(config) errors for all types 1`] = `
exports[`config/validation > validateConfig(config) > errors for all types 1`] = `
[
{
"message": "Configuration option \`azureWorkItemId\` should be an integer. Found: false (boolean).",
@ -88,7 +88,7 @@ exports[`config/validation validateConfig(config) errors for all types 1`] = `
]
`;
exports[`config/validation validateConfig(config) errors for unsafe fileMatches 1`] = `
exports[`config/validation > validateConfig(config) > errors for unsafe fileMatches 1`] = `
[
{
"message": "Invalid regExp for dockerfile.fileMatch: \`x?+\`",
@ -101,7 +101,7 @@ exports[`config/validation validateConfig(config) errors for unsafe fileMatches
]
`;
exports[`config/validation validateConfig(config) errors if customManager fields are missing 1`] = `
exports[`config/validation > validateConfig(config) > errors if customManager fields are missing 1`] = `
[
{
"message": "Regex Managers must contain currentValueTemplate configuration or regex group named currentValue",
@ -110,7 +110,7 @@ exports[`config/validation validateConfig(config) errors if customManager fields
]
`;
exports[`config/validation validateConfig(config) errors if fileMatch has wrong parent 1`] = `
exports[`config/validation > validateConfig(config) > errors if fileMatch has wrong parent 1`] = `
[
{
"message": ""fileMatch" may not be defined at the top level of a config and must instead be within a manager block",
@ -119,7 +119,7 @@ exports[`config/validation validateConfig(config) errors if fileMatch has wrong
]
`;
exports[`config/validation validateConfig(config) errors if fileMatch has wrong parent 2`] = `
exports[`config/validation > validateConfig(config) > errors if fileMatch has wrong parent 2`] = `
[
{
"message": ""fileMatch" must be configured in a manager block and not here: npm.minor",
@ -128,7 +128,7 @@ exports[`config/validation validateConfig(config) errors if fileMatch has wrong
]
`;
exports[`config/validation validateConfig(config) errors if included not supported enabled managers for combined supported and not supported managers 1`] = `
exports[`config/validation > validateConfig(config) > errors if included not supported enabled managers for combined supported and not supported managers 1`] = `
[
{
"message": "The following managers configured in enabledManagers are not supported: "foo"",
@ -137,7 +137,7 @@ exports[`config/validation validateConfig(config) errors if included not support
]
`;
exports[`config/validation validateConfig(config) errors if included not supported enabled managers for multiple not supported managers 1`] = `
exports[`config/validation > validateConfig(config) > errors if included not supported enabled managers for multiple not supported managers 1`] = `
[
{
"message": "The following managers configured in enabledManagers are not supported: "foo, bar"",
@ -146,7 +146,7 @@ exports[`config/validation validateConfig(config) errors if included not support
]
`;
exports[`config/validation validateConfig(config) errors if included not supported enabled managers for single not supported manager 1`] = `
exports[`config/validation > validateConfig(config) > errors if included not supported enabled managers for single not supported manager 1`] = `
[
{
"message": "The following managers configured in enabledManagers are not supported: "foo"",
@ -155,7 +155,7 @@ exports[`config/validation validateConfig(config) errors if included not support
]
`;
exports[`config/validation validateConfig(config) errors if invalid combinations in packageRules 1`] = `
exports[`config/validation > validateConfig(config) > errors if invalid combinations in packageRules 1`] = `
[
{
"message": "packageRules[0]: packageRules cannot combine both matchUpdateTypes and registryUrls. Rule: {"matchUpdateTypes":["major"],"registryUrls":["https://registry.npmjs.org"]}",
@ -164,7 +164,7 @@ exports[`config/validation validateConfig(config) errors if invalid combinations
]
`;
exports[`config/validation validateConfig(config) errors if manager objects are nested 1`] = `
exports[`config/validation > validateConfig(config) > errors if manager objects are nested 1`] = `
[
{
"message": "The "gradle" object can only be configured at the top level of a config but was found inside "maven"",
@ -173,9 +173,9 @@ exports[`config/validation validateConfig(config) errors if manager objects are
]
`;
exports[`config/validation validateConfig(config) ignore packageRule nesting validation for presets 1`] = `[]`;
exports[`config/validation > validateConfig(config) > ignore packageRule nesting validation for presets 1`] = `[]`;
exports[`config/validation validateConfig(config) included managers of the wrong type 1`] = `
exports[`config/validation > validateConfig(config) > included managers of the wrong type 1`] = `
[
{
"message": "Configuration option \`packageRules[0].matchManagers\` should be a list (Array)",
@ -188,7 +188,7 @@ exports[`config/validation validateConfig(config) included managers of the wrong
]
`;
exports[`config/validation validateConfig(config) returns deprecation warnings 1`] = `
exports[`config/validation > validateConfig(config) > returns deprecation warnings 1`] = `
[
{
"message": "Direct editing of prTitle is now deprecated. Please edit commitMessage subcomponents instead as they will be passed through to prTitle.",
@ -197,7 +197,7 @@ exports[`config/validation validateConfig(config) returns deprecation warnings 1
]
`;
exports[`config/validation validateConfig(config) returns nested errors 1`] = `
exports[`config/validation > validateConfig(config) > returns nested errors 1`] = `
[
{
"message": "Invalid configuration option: foo",
@ -218,7 +218,7 @@ exports[`config/validation validateConfig(config) returns nested errors 1`] = `
]
`;
exports[`config/validation validateConfig(config) selectors outside packageRules array trigger errors 1`] = `
exports[`config/validation > validateConfig(config) > selectors outside packageRules array trigger errors 1`] = `
[
{
"message": "ansible.minor.matchDepNames: matchDepNames should be inside a \`packageRule\` only",
@ -239,7 +239,7 @@ exports[`config/validation validateConfig(config) selectors outside packageRules
]
`;
exports[`config/validation validateConfig(config) validates regEx for each fileMatch 1`] = `
exports[`config/validation > validateConfig(config) > validates regEx for each fileMatch 1`] = `
[
{
"message": "Invalid regExp for customManagers[0].fileMatch: \`***$}{]][\`",
@ -248,7 +248,7 @@ exports[`config/validation validateConfig(config) validates regEx for each fileM
]
`;
exports[`config/validation validateConfig(config) warns if hostType has the wrong parent 1`] = `
exports[`config/validation > validateConfig(config) > warns if hostType has the wrong parent 1`] = `
[
{
"message": "hostType should only be configured within one of "hostRules" objects. Was found in .",
@ -257,7 +257,7 @@ exports[`config/validation validateConfig(config) warns if hostType has the wron
]
`;
exports[`config/validation validateConfig(config) warns if only selectors in packageRules 1`] = `
exports[`config/validation > validateConfig(config) > warns if only selectors in packageRules 1`] = `
[
{
"message": "packageRules[0]: Each packageRule must contain at least one non-match* or non-exclude* field. Rule: {"matchDepTypes":["foo"],"matchPackageNames":["bar"]}",

View File

@ -6,8 +6,8 @@ import {
removeGlobalConfig,
} from './index';
jest.mock('../modules/datasource/npm');
jest.mock('../../config.js', () => ({}), { virtual: true });
vi.mock('../modules/datasource/npm');
vi.mock('../../config.js', () => ({ default: {} }));
const defaultConfig = getConfig();

View File

@ -400,7 +400,7 @@ describe('config/migration', () => {
expect(isMigrated).toBeTrue();
});
it('it migrates preset strings to array', () => {
it('migrates preset strings to array', () => {
let config: TestRenovateConfig;
let res: MigratedConfig;
@ -422,7 +422,7 @@ describe('config/migration', () => {
});
});
it('it migrates unpublishSafe', () => {
it('migrates unpublishSafe', () => {
let config: TestRenovateConfig;
let res: MigratedConfig;
@ -505,7 +505,7 @@ describe('config/migration', () => {
});
});
it('it migrates packageRules', () => {
it('migrates packageRules', () => {
const config: TestRenovateConfig = {
packageRules: [
{
@ -575,7 +575,7 @@ describe('config/migration', () => {
});
});
it('it migrates nested packageRules', () => {
it('migrates nested packageRules', () => {
const config: TestRenovateConfig = {
packageRules: [
{
@ -605,7 +605,7 @@ describe('config/migration', () => {
expect(migratedConfig.packageRules).toHaveLength(3);
});
it('it migrates presets', () => {
it('migrates presets', () => {
GlobalConfig.set({
migratePresets: {
'@org': 'local>org/renovate-config',
@ -621,7 +621,7 @@ describe('config/migration', () => {
expect(migratedConfig).toEqual({ extends: ['local>org/renovate-config'] });
});
it('it migrates customManagers', () => {
it('migrates customManagers', () => {
const config: RenovateConfig = {
customManagers: [
{
@ -646,7 +646,7 @@ describe('config/migration', () => {
expect(migratedConfig).toMatchSnapshot();
});
it('it migrates pip-compile', () => {
it('migrates pip-compile', () => {
const config: RenovateConfig = {
'pip-compile': {
enabled: true,
@ -678,7 +678,7 @@ describe('config/migration', () => {
});
});
it('it migrates gradle-lite', () => {
it('migrates gradle-lite', () => {
const config: RenovateConfig = {
'gradle-lite': {
enabled: true,
@ -757,7 +757,7 @@ describe('config/migration', () => {
});
});
it('it migrates dryRun', () => {
it('migrates dryRun', () => {
let config: TestRenovateConfig;
let res: MigratedConfig;

View File

@ -2,7 +2,7 @@ import { GlobalConfig } from '../../global';
import { ExtendsMigration } from './extends-migration';
describe('config/migrations/custom/extends-migration', () => {
it('it migrates preset strings to array', () => {
it('migrates preset strings to array', () => {
expect(ExtendsMigration).toMigrate(
{
extends: ':js-app',
@ -22,7 +22,7 @@ describe('config/migrations/custom/extends-migration', () => {
);
});
it('it migrates presets array', () => {
it('migrates presets array', () => {
expect(ExtendsMigration).toMigrate(
{
extends: ['foo', ':js-app', 'bar'],
@ -55,7 +55,7 @@ describe('config/migrations/custom/extends-migration', () => {
);
});
it('it migrates presets', () => {
it('migrates presets', () => {
GlobalConfig.set({
migratePresets: {
'@org': 'local>org/renovate-config',

View File

@ -13,7 +13,7 @@ describe('config/migrations/custom/go-mod-tidy-migration', () => {
);
});
it('should handle case when postUpdateOptions is not defined ', () => {
it('should handle case when postUpdateOptions is not defined', () => {
expect(GoModTidyMigration).toMigrate(
{
gomodTidy: true,

View File

@ -2,7 +2,7 @@ import * as manager from '../../modules/manager';
import * as platform from '../../modules/platform';
import { getOptions } from '.';
jest.unmock('../../modules/platform');
vi.unmock('../../modules/platform');
describe('config/options/index', () => {
it('test manager should have no defaultConfig', () => {

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`config/presets/index getPreset gets linters 1`] = `
exports[`config/presets/index > getPreset > gets linters 1`] = `
{
"description": [
"All lint-related packages.",
@ -20,13 +20,13 @@ exports[`config/presets/index getPreset gets linters 1`] = `
}
`;
exports[`config/presets/index getPreset handles 404 packages 1`] = `undefined`;
exports[`config/presets/index > getPreset > handles 404 packages 1`] = `undefined`;
exports[`config/presets/index getPreset handles 404 packages 2`] = `undefined`;
exports[`config/presets/index > getPreset > handles 404 packages 2`] = `undefined`;
exports[`config/presets/index getPreset handles 404 packages 3`] = `undefined`;
exports[`config/presets/index > getPreset > handles 404 packages 3`] = `undefined`;
exports[`config/presets/index resolvePreset migrates automerge in presets 1`] = `
exports[`config/presets/index > resolvePreset > migrates automerge in presets 1`] = `
{
"automergeType": "pr",
"branchPrefix": "renovate/",
@ -136,7 +136,7 @@ exports[`config/presets/index resolvePreset migrates automerge in presets 1`] =
}
`;
exports[`config/presets/index resolvePreset resolves eslint 1`] = `
exports[`config/presets/index > resolvePreset > resolves eslint 1`] = `
{
"matchPackageNames": [
"@types/eslint",
@ -153,7 +153,7 @@ exports[`config/presets/index resolvePreset resolves eslint 1`] = `
}
`;
exports[`config/presets/index resolvePreset resolves linters 1`] = `
exports[`config/presets/index > resolvePreset > resolves linters 1`] = `
{
"description": [
"All lint-related packages.",
@ -183,7 +183,7 @@ exports[`config/presets/index resolvePreset resolves linters 1`] = `
}
`;
exports[`config/presets/index resolvePreset resolves nested groups 1`] = `
exports[`config/presets/index > resolvePreset > resolves nested groups 1`] = `
{
"description": [
"Update lint packages automatically if tests pass.",
@ -221,7 +221,7 @@ exports[`config/presets/index resolvePreset resolves nested groups 1`] = `
}
`;
exports[`config/presets/index resolvePreset resolves self-hosted presets without baseConfig 1`] = `
exports[`config/presets/index > resolvePreset > resolves self-hosted presets without baseConfig 1`] = `
{
"labels": [
"self-hosted resolved",

View File

@ -7,7 +7,7 @@ import { toBase64 } from '../../../util/string';
import { PRESET_INVALID_JSON, PRESET_NOT_FOUND } from '../util';
import * as gitea from '.';
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
const hostRules = mocked(_hostRules);

View File

@ -6,7 +6,7 @@ import { toBase64 } from '../../../util/string';
import { PRESET_INVALID_JSON, PRESET_NOT_FOUND } from '../util';
import * as github from '.';
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
const hostRules = mocked(_hostRules);

View File

@ -16,10 +16,10 @@ import {
} from './util';
import * as presets from '.';
jest.mock('./npm');
jest.mock('./github');
jest.mock('./local');
jest.mock('../../util/cache/package', () => mockDeep());
vi.mock('./npm');
vi.mock('./github');
vi.mock('./local');
vi.mock('../../util/cache/package', () => mockDeep());
const npm = mocked(_npm);
const local = mocked(_local);

View File

@ -5,8 +5,8 @@ import { validateConfig } from '../../validation';
import * as npm from '../npm';
import * as internal from '.';
jest.mock('../npm');
jest.mock('../../../modules/datasource/npm');
vi.mock('../npm');
vi.mock('../../../modules/datasource/npm');
jest.spyOn(npm, 'getPreset').mockResolvedValue(undefined);

View File

@ -5,9 +5,9 @@ import * as _github from '../github';
import * as _gitlab from '../gitlab';
import * as local from '.';
jest.mock('../gitea');
jest.mock('../github');
jest.mock('../gitlab');
vi.mock('../gitea');
vi.mock('../github');
vi.mock('../gitlab');
const gitea = mocked(_gitea);
const github = mocked(_github);

View File

@ -43,6 +43,7 @@ describe('config/presets/util', () => {
await expect(fetchPreset({ ...config, fetch })).rejects.toThrow('fails');
});
// eslint-disable-next-line vitest/valid-title
it(PRESET_DEP_NOT_FOUND, async () => {
fetch.mockResolvedValueOnce(null);
await expect(fetchPreset({ ...config, fetch })).rejects.toThrow(
@ -56,6 +57,7 @@ describe('config/presets/util', () => {
);
});
// eslint-disable-next-line vitest/valid-title
it(PRESET_NOT_FOUND, async () => {
fetch.mockResolvedValueOnce({});
await expect(

View File

@ -40,11 +40,11 @@ describe('constants/platform', () => {
expect(GITLAB_API_USING_HOST_TYPES.includes('gitlab')).toBeTrue();
});
it('should be not part of the GITLAB_API_USING_HOST_TYPES ', () => {
it('should be not part of the GITLAB_API_USING_HOST_TYPES', () => {
expect(GITLAB_API_USING_HOST_TYPES.includes('github')).toBeFalse();
});
it('should be part of the GITHUB_API_USING_HOST_TYPES ', () => {
it('should be part of the GITHUB_API_USING_HOST_TYPES', () => {
expect(
GITHUB_API_USING_HOST_TYPES.includes(GithubTagsDatasource.id),
).toBeTrue();
@ -61,11 +61,11 @@ describe('constants/platform', () => {
expect(GITHUB_API_USING_HOST_TYPES.includes('github')).toBeTrue();
});
it('should be not part of the GITHUB_API_USING_HOST_TYPES ', () => {
it('should be not part of the GITHUB_API_USING_HOST_TYPES', () => {
expect(GITHUB_API_USING_HOST_TYPES.includes('gitlab')).toBeFalse();
});
it('should be part of the BITBUCKET_API_USING_HOST_TYPES ', () => {
it('should be part of the BITBUCKET_API_USING_HOST_TYPES', () => {
expect(
BITBUCKET_API_USING_HOST_TYPES.includes(BitbucketTagsDatasource.id),
).toBeTrue();

View File

@ -1,5 +1,5 @@
import type { S3Client } from '@aws-sdk/client-s3';
import { mockDeep } from 'jest-mock-extended';
import { mock, mockDeep } from 'vitest-mock-extended';
import { s3 } from '../../test/s3';
import { fs, logger } from '../../test/util';
import type { RenovateConfig } from '../config/types';
@ -16,9 +16,9 @@ import {
} from './reporting';
import type { Report } from './types';
jest.mock('../util/fs', () => mockDeep());
jest.mock('../util/s3', () => mockDeep());
jest.mock('../logger', () => mockDeep());
vi.mock('../util/fs', () => mockDeep());
vi.mock('../util/s3', () => mockDeep());
vi.mock('../logger', () => mockDeep());
describe('instrumentation/reporting', () => {
beforeEach(() => {
@ -133,9 +133,8 @@ describe('instrumentation/reporting', () => {
});
it('send report to an S3 bucket if reportType is s3', async () => {
const mockClient = mockDeep<S3Client>();
const mockClient = mock<S3Client>();
s3.parseS3Url.mockReturnValue({ Bucket: 'bucket-name', Key: 'key-name' });
// @ts-expect-error TS2589
s3.getS3Client.mockReturnValue(mockClient);
const config: RenovateConfig = {

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`logger/config-serializer squashes templates 1`] = `
exports[`logger/config-serializer > squashes templates 1`] = `
{
"nottoken": "b",
"prBody": "[Template]",
}
`;
exports[`logger/config-serializer suppresses content 1`] = `
exports[`logger/config-serializer > suppresses content 1`] = `
{
"content": "[content]",
}

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`logger/err-serializer got sanitize http error 1`] = `
exports[`logger/err-serializer > got > sanitize http error 1`] = `
{
"code": "ERR_NON_2XX_3XX_RESPONSE",
"message": "Response code 412 (Precondition Failed)",

View File

@ -22,8 +22,8 @@ import {
const initialContext = 'initial_context';
jest.unmock('.');
jest.mock('nanoid', () => ({
vi.unmock('.');
vi.mock('nanoid', () => ({
nanoid: () => 'initial_context',
}));

View File

@ -1,7 +1,7 @@
import { once, reset } from './once';
import { logger } from '.';
jest.unmock('.');
vi.unmock('.');
describe('logger/once', () => {
afterEach(() => {

View File

@ -2,12 +2,12 @@ import chalk from 'chalk';
import * as prettyStdout from './pretty-stdout';
import type { BunyanRecord } from './types';
jest.mock('chalk', () =>
['bgRed', 'blue', 'gray', 'green', 'magenta', 'red'].reduce(
vi.mock('chalk', () => ({
default: ['bgRed', 'blue', 'gray', 'green', 'magenta', 'red'].reduce(
(r, c) => Object.defineProperty(r, c, { value: (s: string) => s }),
{},
),
);
}));
describe('logger/pretty-stdout', () => {
describe('getMeta(rec)', () => {

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/metadata Should handle failed parsing of sourceUrls for GitLab 1`] = `
exports[`modules/datasource/metadata > Should handle failed parsing of sourceUrls for GitLab 1`] = `
{
"releases": [
{
@ -16,7 +16,7 @@ exports[`modules/datasource/metadata Should handle failed parsing of sourceUrls
}
`;
exports[`modules/datasource/metadata Should handle failed parsing of sourceUrls for other 1`] = `
exports[`modules/datasource/metadata > Should handle failed parsing of sourceUrls for other 1`] = `
{
"releases": [
{
@ -32,7 +32,7 @@ exports[`modules/datasource/metadata Should handle failed parsing of sourceUrls
}
`;
exports[`modules/datasource/metadata Should handle manualChangelogUrls 1`] = `
exports[`modules/datasource/metadata > Should handle manualChangelogUrls 1`] = `
{
"changelogUrl": "https://github.com/flyingcircusio/pycountry/blob/master/HISTORY.txt",
"releases": [
@ -57,7 +57,7 @@ exports[`modules/datasource/metadata Should handle manualChangelogUrls 1`] = `
}
`;
exports[`modules/datasource/metadata Should handle manualSourceUrls 1`] = `
exports[`modules/datasource/metadata > Should handle manualSourceUrls 1`] = `
{
"releases": [
{
@ -81,7 +81,7 @@ exports[`modules/datasource/metadata Should handle manualSourceUrls 1`] = `
}
`;
exports[`modules/datasource/metadata Should handle non-url 1`] = `
exports[`modules/datasource/metadata > Should handle non-url 1`] = `
{
"releases": [
{
@ -96,7 +96,7 @@ exports[`modules/datasource/metadata Should handle non-url 1`] = `
}
`;
exports[`modules/datasource/metadata Should handle parsing of sourceUrls correctly 1`] = `
exports[`modules/datasource/metadata > Should handle parsing of sourceUrls correctly 1`] = `
{
"releases": [
{
@ -120,7 +120,7 @@ exports[`modules/datasource/metadata Should handle parsing of sourceUrls correct
}
`;
exports[`modules/datasource/metadata Should handle parsing of sourceUrls correctly for GitLab also 1`] = `
exports[`modules/datasource/metadata > Should handle parsing of sourceUrls correctly for GitLab also 1`] = `
{
"releases": [
{
@ -136,7 +136,7 @@ exports[`modules/datasource/metadata Should handle parsing of sourceUrls correct
}
`;
exports[`modules/datasource/metadata Should massage github sourceUrls 1`] = `
exports[`modules/datasource/metadata > Should massage github sourceUrls 1`] = `
{
"releases": [
{

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/artifactory/index getReleases parses real data (files): without slash at the end 1`] = `
exports[`modules/datasource/artifactory/index > getReleases > parses real data (files): without slash at the end 1`] = `
{
"registryUrl": "https://jfrog.company.com/artifactory",
"releases": [
@ -24,7 +24,7 @@ exports[`modules/datasource/artifactory/index getReleases parses real data (file
}
`;
exports[`modules/datasource/artifactory/index getReleases parses real data (folders): with slash at the end 1`] = `
exports[`modules/datasource/artifactory/index > getReleases > parses real data (folders): with slash at the end 1`] = `
{
"registryUrl": "https://jfrog.company.com/artifactory",
"releases": [
@ -48,7 +48,7 @@ exports[`modules/datasource/artifactory/index getReleases parses real data (fold
}
`;
exports[`modules/datasource/artifactory/index getReleases parses real data (merge strategy with 2 registries) 1`] = `
exports[`modules/datasource/artifactory/index > getReleases > parses real data (merge strategy with 2 registries) 1`] = `
{
"releases": [
{

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/aws-machine-image/index getSortedAwsMachineImages() with 1 returned image 1`] = `
exports[`modules/datasource/aws-machine-image/index > getSortedAwsMachineImages() > with 1 returned image 1`] = `
[
DescribeImagesCommand {
"deserialize": [Function],
@ -38,7 +38,7 @@ exports[`modules/datasource/aws-machine-image/index getSortedAwsMachineImages()
]
`;
exports[`modules/datasource/aws-machine-image/index getSortedAwsMachineImages() with 3 returned images 1`] = `
exports[`modules/datasource/aws-machine-image/index > getSortedAwsMachineImages() > with 3 returned images 1`] = `
[
DescribeImagesCommand {
"deserialize": [Function],
@ -76,7 +76,7 @@ exports[`modules/datasource/aws-machine-image/index getSortedAwsMachineImages()
]
`;
exports[`modules/datasource/aws-machine-image/index getSortedAwsMachineImages() without returned images 1`] = `
exports[`modules/datasource/aws-machine-image/index > getSortedAwsMachineImages() > without returned images 1`] = `
[
DescribeImagesCommand {
"deserialize": [Function],

View File

@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/bitbucket-tags/index getDigest returns commits from bitbucket cloud 1`] = `"123"`;
exports[`modules/datasource/bitbucket-tags/index > getDigest > returns commits from bitbucket cloud 1`] = `"123"`;
exports[`modules/datasource/bitbucket-tags/index getReleases returns tags from bitbucket cloud 1`] = `
exports[`modules/datasource/bitbucket-tags/index > getReleases > returns tags from bitbucket cloud 1`] = `
{
"registryUrl": "https://bitbucket.org",
"releases": [
@ -24,4 +24,4 @@ exports[`modules/datasource/bitbucket-tags/index getReleases returns tags from b
}
`;
exports[`modules/datasource/bitbucket-tags/index getTagCommit returns tags commit hash from bitbucket cloud 1`] = `"123"`;
exports[`modules/datasource/bitbucket-tags/index > getTagCommit > returns tags commit hash from bitbucket cloud 1`] = `"123"`;

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/cdnjs/index getReleases processes real data 1`] = `
exports[`modules/datasource/cdnjs/index > getReleases > processes real data 1`] = `
{
"homepage": "https://d3js.org/d3-force/",
"registryUrl": "https://api.cdnjs.com/",

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/clojure/index falls back to next registry url 1`] = `
exports[`modules/datasource/clojure/index > falls back to next registry url 1`] = `
{
"display": "org.example:package",
"group": "org.example",
@ -37,7 +37,7 @@ exports[`modules/datasource/clojure/index falls back to next registry url 1`] =
}
`;
exports[`modules/datasource/clojure/index ignores unsupported protocols 1`] = `
exports[`modules/datasource/clojure/index > ignores unsupported protocols 1`] = `
[
{
"version": "0.0.1",
@ -66,7 +66,7 @@ exports[`modules/datasource/clojure/index ignores unsupported protocols 1`] = `
]
`;
exports[`modules/datasource/clojure/index returns releases from custom repository 1`] = `
exports[`modules/datasource/clojure/index > returns releases from custom repository 1`] = `
{
"display": "org.example:package",
"group": "org.example",
@ -104,7 +104,7 @@ exports[`modules/datasource/clojure/index returns releases from custom repositor
}
`;
exports[`modules/datasource/clojure/index skips registry with invalid XML 1`] = `
exports[`modules/datasource/clojure/index > skips registry with invalid XML 1`] = `
{
"display": "org.example:package",
"group": "org.example",
@ -141,7 +141,7 @@ exports[`modules/datasource/clojure/index skips registry with invalid XML 1`] =
}
`;
exports[`modules/datasource/clojure/index skips registry with invalid metadata structure 1`] = `
exports[`modules/datasource/clojure/index > skips registry with invalid metadata structure 1`] = `
{
"display": "org.example:package",
"group": "org.example",

View File

@ -244,7 +244,7 @@ describe('modules/datasource/conan/index', () => {
).toBeNull();
});
it('it handles mismatched userAndChannel versioned data', async () => {
it('handles mismatched userAndChannel versioned data', async () => {
httpMock
.scope(nonDefaultRegistryUrl)
.get('/v2/conans/search?q=poco')

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/conda/index getReleases processes real data 1`] = `
exports[`modules/datasource/conda/index > getReleases > processes real data 1`] = `
{
"homepage": "http://anaconda.org/anaconda/pytest",
"registryUrl": "https://api.anaconda.org/package",

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/crate/index getReleases clones cloudsmith private registry 1`] = `
exports[`modules/datasource/crate/index > getReleases > clones cloudsmith private registry 1`] = `
{
"dependencyUrl": "https://cloudsmith.io/~myorg/repos/myrepo/packages/detail/cargo/mypkg",
"registryUrl": "https://dl.cloudsmith.io/basic/myorg/myrepo/cargo/index.git",
@ -15,7 +15,7 @@ exports[`modules/datasource/crate/index getReleases clones cloudsmith private re
}
`;
exports[`modules/datasource/crate/index getReleases clones other private registry 1`] = `
exports[`modules/datasource/crate/index > getReleases > clones other private registry 1`] = `
{
"dependencyUrl": "https://github.com/mcorbin/testregistry/mypkg",
"registryUrl": "https://github.com/mcorbin/testregistry",
@ -30,7 +30,7 @@ exports[`modules/datasource/crate/index getReleases clones other private registr
}
`;
exports[`modules/datasource/crate/index getReleases processes real data: amethyst 1`] = `
exports[`modules/datasource/crate/index > getReleases > processes real data: amethyst 1`] = `
{
"dependencyUrl": "https://crates.io/crates/amethyst",
"homepage": "https://amethyst.rs/",
@ -99,7 +99,7 @@ exports[`modules/datasource/crate/index getReleases processes real data: amethys
}
`;
exports[`modules/datasource/crate/index getReleases processes real data: libc 1`] = `
exports[`modules/datasource/crate/index > getReleases > processes real data: libc 1`] = `
{
"dependencyUrl": "https://crates.io/crates/libc",
"registryUrl": "https://crates.io",

View File

@ -5,9 +5,11 @@ import _simpleGit from 'simple-git';
import type { DirectoryResult } from 'tmp-promise';
import { dir } from 'tmp-promise';
import { dirname, join } from 'upath';
import type { MockedFunction } from 'vitest';
import { getPkgReleases } from '..';
import { Fixtures } from '../../../../test/fixtures';
import * as httpMock from '../../../../test/http-mock';
import { partial } from '../../../../test/util';
import { GlobalConfig } from '../../../config/global';
import type { RepoGlobalConfig } from '../../../config/types';
import { EXTERNAL_HOST_ERROR } from '../../../constants/error-messages';
@ -15,8 +17,8 @@ import * as memCache from '../../../util/cache/memory';
import type { RegistryInfo } from './types';
import { CrateDatasource } from '.';
jest.mock('simple-git');
const simpleGit: jest.Mock<Partial<SimpleGit>> = _simpleGit as never;
vi.mock('simple-git');
const simpleGit = vi.mocked(_simpleGit);
const API_BASE_URL = CrateDatasource.CRATES_IO_API_BASE_URL;
@ -25,8 +27,10 @@ const baseUrl =
const datasource = CrateDatasource.id;
function setupGitMocks(delayMs?: number): { mockClone: jest.Mock<any, any> } {
const mockClone = jest
function setupGitMocks(delayMs?: number): {
mockClone: MockedFunction<SimpleGit['clone']>;
} {
const mockClone = vi
.fn()
.mockName('clone')
.mockImplementation(
@ -41,24 +45,25 @@ function setupGitMocks(delayMs?: number): { mockClone: jest.Mock<any, any> } {
},
);
simpleGit.mockReturnValue({
clone: mockClone,
});
simpleGit.mockReturnValue(partial<SimpleGit>({ clone: mockClone }));
return { mockClone };
}
function setupErrorGitMock(): { mockClone: jest.Mock<any, any> } {
const mockClone = jest
function setupErrorGitMock(): {
mockClone: MockedFunction<SimpleGit['clone']>;
} {
const mockClone = vi
.fn()
.mockName('clone')
.mockImplementation((_registryUrl: string, _clonePath: string, _opts) =>
Promise.reject(new Error('mocked error')),
);
simpleGit.mockReturnValue({
clone: mockClone,
});
simpleGit.mockReturnValue(
partial<SimpleGit>({
clone: mockClone,
}),
);
return { mockClone };
}

View File

@ -6,7 +6,7 @@ import { fs } from '../../../../test/util';
import { logger } from '../../../logger';
import { CustomDatasource } from './index';
jest.mock('../../../util/fs');
vi.mock('../../../util/fs');
describe('modules/datasource/custom/index', () => {
describe('getReleases', () => {

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/dart/index getReleases processes real data 1`] = `
exports[`modules/datasource/dart/index > getReleases > processes real data 1`] = `
{
"homepage": "https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences",
"registryUrl": "https://pub.dartlang.org",

View File

@ -17,7 +17,7 @@ const hostRules = mocked(_hostRules);
const http = new Http(dockerDatasourceId);
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
describe('modules/datasource/docker/common', () => {
describe('getRegistryRepository', () => {

View File

@ -4,7 +4,7 @@ import type { DockerHubCacheData } from './dockerhub-cache';
import { DockerHubCache } from './dockerhub-cache';
import type { DockerHubTag } from './schema';
jest.mock('../../../util/cache/package');
vi.mock('../../../util/cache/package');
const packageCache = mocked(_packageCache);
function oldCacheData(): DockerHubCacheData {

View File

@ -13,10 +13,10 @@ import * as _hostRules from '../../../util/host-rules';
import { DockerDatasource } from '.';
const hostRules = mocked(_hostRules);
const googleAuth = mocked(_googleAuth);
const googleAuth = vi.mocked(_googleAuth, true);
jest.mock('../../../util/host-rules', () => mockDeep());
jest.mock('google-auth-library');
vi.mock('../../../util/host-rules', () => mockDeep());
vi.mock('google-auth-library');
const ecrMock = mockClient(ECRClient);

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/flutter-version/index getReleases processes real data 1`] = `
exports[`modules/datasource/flutter-version/index > getReleases > processes real data 1`] = `
{
"homepage": "https://flutter.dev",
"registryUrl": "https://storage.googleapis.com",

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/galaxy-collection/index getReleases processes real data 1`] = `
exports[`modules/datasource/galaxy-collection/index > getReleases > processes real data 1`] = `
{
"registryUrl": "https://galaxy.ansible.com/api",
"releases": [
@ -33,7 +33,7 @@ exports[`modules/datasource/galaxy-collection/index getReleases processes real d
}
`;
exports[`modules/datasource/galaxy-collection/index getReleases processes real data with automation hub URL 1`] = `
exports[`modules/datasource/galaxy-collection/index > getReleases > processes real data with automation hub URL 1`] = `
{
"registryUrl": "https://my.automationhub.local/api/galaxy/content/published",
"releases": [

View File

@ -119,7 +119,7 @@ describe('modules/datasource/galaxy-collection/index', () => {
).toBeNull();
});
it('returns null for null packageName ', async () => {
it('returns null for null packageName', async () => {
expect(
await getPkgReleases({
datasource,

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/galaxy/index getReleases processes real data 1`] = `
exports[`modules/datasource/galaxy/index > getReleases > processes real data 1`] = `
{
"dependencyUrl": "https://galaxy.ansible.com/yatesr/timezone",
"registryUrl": "https://galaxy.ansible.com/",

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/git-refs/index getReleases returns versions filtered from tags 1`] = `
exports[`modules/datasource/git-refs/index > getReleases > returns versions filtered from tags 1`] = `
{
"releases": [
{

View File

@ -1,12 +1,14 @@
import type { SimpleGit } from 'simple-git';
import { simpleGit } from 'simple-git';
import type { MockProxy } from 'vitest-mock-extended';
import { mock } from 'vitest-mock-extended';
import { getPkgReleases } from '..';
import { Fixtures } from '../../../../test/fixtures';
import { add, clear } from '../../../util/host-rules';
import { GitRefsDatasource } from '.';
jest.mock('simple-git');
const simpleGitFactoryMock = simpleGit as jest.Mock<Partial<SimpleGit>>;
vi.mock('simple-git');
const simpleGitFactoryMock = vi.mocked(simpleGit);
const packageName = 'https://github.com/example/example.git';
@ -15,7 +17,7 @@ const lsRemote1 = Fixtures.get('ls-remote-1.txt');
const datasource = GitRefsDatasource.id;
describe('modules/datasource/git-refs/index', () => {
let gitMock: jest.MockedObject<Pick<SimpleGit, 'env' | 'listRemote'>>;
let gitMock: MockProxy<SimpleGit>;
beforeEach(() => {
// clear host rules
@ -25,13 +27,13 @@ describe('modules/datasource/git-refs/index', () => {
process.env = {};
// reset git mock
gitMock = {
env: jest.fn(),
listRemote: jest.fn(),
};
gitMock = mock<SimpleGit>({
env: vi.fn(),
listRemote: vi.fn(),
});
simpleGitFactoryMock.mockReturnValue(gitMock);
gitMock.env.mockImplementation(() => gitMock as unknown as SimpleGit);
gitMock.env.mockReturnValue(gitMock);
});
describe('getReleases', () => {

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/git-tags/index getReleases returns versions filtered from tags 1`] = `
exports[`modules/datasource/git-tags/index > getReleases > returns versions filtered from tags 1`] = `
{
"releases": [
{

View File

@ -1,12 +1,14 @@
import type { SimpleGit } from 'simple-git';
import { simpleGit } from 'simple-git';
import type { MockProxy } from 'vitest-mock-extended';
import { mock } from 'vitest-mock-extended';
import { getPkgReleases } from '..';
import { Fixtures } from '../../../../test/fixtures';
import { add, clear } from '../../../util/host-rules';
import { GitTagsDatasource } from '.';
jest.mock('simple-git');
const simpleGitFactoryMock = simpleGit as jest.Mock<Partial<SimpleGit>>;
vi.mock('simple-git');
const simpleGitFactoryMock = vi.mocked(simpleGit);
const packageName = 'https://github.com/example/example.git';
@ -16,7 +18,7 @@ const datasource = GitTagsDatasource.id;
const datasourceInstance = new GitTagsDatasource();
describe('modules/datasource/git-tags/index', () => {
let gitMock: jest.MockedObject<Pick<SimpleGit, 'env' | 'listRemote'>>;
let gitMock: MockProxy<SimpleGit>;
beforeEach(() => {
// clear host rules
@ -26,13 +28,13 @@ describe('modules/datasource/git-tags/index', () => {
process.env = {};
// reset git mock
gitMock = {
env: jest.fn(),
listRemote: jest.fn(),
};
gitMock = mock<SimpleGit>({
env: vi.fn(),
listRemote: vi.fn(),
});
simpleGitFactoryMock.mockReturnValue(gitMock);
gitMock.env.mockImplementation(() => gitMock as unknown as SimpleGit);
gitMock.env.mockReturnValue(gitMock);
});
describe('getReleases', () => {

View File

@ -7,7 +7,7 @@ import type { Timestamp } from '../../../util/timestamp';
import { GitHubReleaseAttachmentMocker } from './test';
import { GithubReleaseAttachmentsDatasource } from '.';
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
const hostRules = mocked(_hostRules);
const githubApiHost = 'https://api.github.com';

View File

@ -6,7 +6,7 @@ import * as _hostRules from '../../../util/host-rules';
import type { Timestamp } from '../../../util/timestamp';
import { GithubReleasesDatasource } from '.';
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
const hostRules = mocked(_hostRules);
describe('modules/datasource/github-releases/index', () => {

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/gitlab-packages/index getReleases returns package from custom registry 1`] = `
exports[`modules/datasource/gitlab-packages/index > getReleases > returns package from custom registry 1`] = `
{
"registryUrl": "https://gitlab.com",
"releases": [

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/gitlab-releases/index getReleases returns releases from custom registry 1`] = `
exports[`modules/datasource/gitlab-releases/index > getReleases > returns releases from custom registry 1`] = `
{
"registryUrl": "https://gitlab.company.com",
"releases": [
@ -21,7 +21,7 @@ exports[`modules/datasource/gitlab-releases/index getReleases returns releases f
}
`;
exports[`modules/datasource/gitlab-releases/index getReleases returns releases from default registry 1`] = `
exports[`modules/datasource/gitlab-releases/index > getReleases > returns releases from default registry 1`] = `
{
"registryUrl": "https://gitlab.com",
"releases": [

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/gitlab-tags/index getReleases returns tags from custom registry 1`] = `
exports[`modules/datasource/gitlab-tags/index > getReleases > returns tags from custom registry 1`] = `
{
"registryUrl": "https://gitlab.company.com/api/v4",
"releases": [
@ -22,7 +22,7 @@ exports[`modules/datasource/gitlab-tags/index getReleases returns tags from cust
}
`;
exports[`modules/datasource/gitlab-tags/index getReleases returns tags from custom registry in sub path 1`] = `
exports[`modules/datasource/gitlab-tags/index > getReleases > returns tags from custom registry in sub path 1`] = `
{
"registryUrl": "https://my.company.com/gitlab",
"releases": [
@ -44,7 +44,7 @@ exports[`modules/datasource/gitlab-tags/index getReleases returns tags from cust
}
`;
exports[`modules/datasource/gitlab-tags/index getReleases returns tags with default registry 1`] = `
exports[`modules/datasource/gitlab-tags/index > getReleases > returns tags with default registry 1`] = `
{
"registryUrl": "https://gitlab.com",
"releases": [

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/go/releases-direct getReleases support bitbucket tags 1`] = `
exports[`modules/datasource/go/releases-direct > getReleases > support bitbucket tags 1`] = `
{
"registryUrl": "https://bitbucket.org",
"releases": [
@ -19,7 +19,7 @@ exports[`modules/datasource/go/releases-direct getReleases support bitbucket tag
}
`;
exports[`modules/datasource/go/releases-direct getReleases support git 1`] = `
exports[`modules/datasource/go/releases-direct > getReleases > support git 1`] = `
{
"releases": [
{
@ -35,7 +35,7 @@ exports[`modules/datasource/go/releases-direct getReleases support git 1`] = `
}
`;
exports[`modules/datasource/go/releases-direct getReleases support gitlab 1`] = `
exports[`modules/datasource/go/releases-direct > getReleases > support gitlab 1`] = `
{
"releases": [
{
@ -53,7 +53,7 @@ exports[`modules/datasource/go/releases-direct getReleases support gitlab 1`] =
}
`;
exports[`modules/datasource/go/releases-direct getReleases support gitlab subgroups 1`] = `
exports[`modules/datasource/go/releases-direct > getReleases > support gitlab subgroups 1`] = `
{
"releases": [
{
@ -71,7 +71,7 @@ exports[`modules/datasource/go/releases-direct getReleases support gitlab subgro
}
`;
exports[`modules/datasource/go/releases-direct getReleases support self hosted gitlab private repositories 1`] = `
exports[`modules/datasource/go/releases-direct > getReleases > support self hosted gitlab private repositories 1`] = `
{
"releases": [
{

View File

@ -9,7 +9,7 @@ import { GithubTagsDatasource } from '../github-tags';
import { GitlabTagsDatasource } from '../gitlab-tags';
import { BaseGoDatasource } from './base';
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
const hostRules = mocked(_hostRules);
@ -120,7 +120,6 @@ describe('modules/datasource/go/base', () => {
});
});
// eslint-disable-next-line jest/no-disabled-tests
it.skip('supports Go submodules in GitLab repo', async () => {
httpMock
.scope('https://gitlab.com')
@ -503,7 +502,7 @@ describe('modules/datasource/go/base', () => {
expect(res).toBeNull();
});
it('it correctly splits a URL where the endpoint is contained', async () => {
it('correctly splits a URL where the endpoint is contained', async () => {
hostRules.hostType.mockReturnValue('gitlab');
GlobalConfig.set({ endpoint: 'https://example.com/gitlab/api/v4/' });

View File

@ -5,7 +5,7 @@ import { mocked } from '../../../../test/util';
import * as _hostRules from '../../../util/host-rules';
import { GoDatasource } from '.';
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
const hostRules = mocked(_hostRules);
const getReleasesDirectMock = jest.fn();
@ -15,7 +15,7 @@ const getDigestGithubMock = jest.fn();
const getDigestGitlabMock = jest.fn();
const getDigestGitMock = jest.fn();
const getDigestBitbucketMock = jest.fn();
jest.mock('./releases-direct', () => {
vi.mock('./releases-direct', () => {
return {
GoDirectDatasource: jest.fn().mockImplementation(() => {
return {
@ -33,7 +33,7 @@ jest.mock('./releases-direct', () => {
});
const getReleasesProxyMock = jest.fn();
jest.mock('./releases-goproxy', () => {
vi.mock('./releases-goproxy', () => {
return {
GoProxyDatasource: jest.fn().mockImplementation(() => {
return {

View File

@ -7,8 +7,8 @@ import { GithubTagsDatasource } from '../github-tags';
import { BaseGoDatasource } from './base';
import { GoDirectDatasource } from './releases-direct';
jest.mock('../../../util/host-rules', () => mockDeep());
jest.mock('./base');
vi.mock('../../../util/host-rules', () => mockDeep());
vi.mock('./base');
const datasource = new GoDirectDatasource();
const getDatasourceSpy = jest.spyOn(BaseGoDatasource, 'getDatasource');

View File

@ -9,7 +9,7 @@ import { GithubTagsDatasource } from '../github-tags';
import { GoProxyDatasource } from './releases-goproxy';
const hostRules = mocked(_hostRules);
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
const datasource = new GoProxyDatasource();
@ -205,13 +205,13 @@ describe('modules/datasource/go/releases-goproxy', () => {
});
});
it.each<{ abortOnError: boolean }>`
it.each`
abortOnError
${true}
${false}
`(
'handles pipe fallback when abortOnError is $abortOnError',
async ({ abortOnError }) => {
async ({ abortOnError }: { abortOnError: boolean }) => {
process.env.GOPROXY = `https://example.com|${baseUrl}`;
hostRules.find.mockReturnValue({ abortOnError });
@ -424,13 +424,13 @@ describe('modules/datasource/go/releases-goproxy', () => {
});
});
it.each<{ abortOnError: boolean }>`
it.each`
abortOnError
${true}
${false}
`(
'handles major releases with abortOnError is $abortOnError',
async ({ abortOnError }) => {
async ({ abortOnError }: { abortOnError: boolean }) => {
process.env.GOPROXY = baseUrl;
hostRules.find.mockReturnValue({ abortOnError });

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/golang-version/index getReleases parses real data 1`] = `
exports[`modules/datasource/golang-version/index > getReleases > parses real data 1`] = `
{
"homepage": "https://go.dev/",
"registryUrl": "https://raw.githubusercontent.com/golang/website",

View File

@ -119,7 +119,7 @@ describe('modules/datasource/golang-version/index', () => {
).toBeNull();
});
it('throws ExternalHostError for invalid release format beginning ', async () => {
it('throws ExternalHostError for invalid release format beginning', async () => {
httpMock
.scope('https://raw.githubusercontent.com')
.get('/golang/website/HEAD/internal/history/release.go')

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/gradle-version/index getReleases calls configured registryUrls 1`] = `
exports[`modules/datasource/gradle-version/index > getReleases > calls configured registryUrls 1`] = `
{
"homepage": "https://gradle.org",
"releases": [
@ -1820,7 +1820,7 @@ exports[`modules/datasource/gradle-version/index getReleases calls configured re
}
`;
exports[`modules/datasource/gradle-version/index getReleases processes real data 1`] = `
exports[`modules/datasource/gradle-version/index > getReleases > processes real data 1`] = `
{
"homepage": "https://gradle.org",
"registryUrl": "https://services.gradle.org/versions/all",

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/helm/index getReleases returns list of versions for normal response 1`] = `
exports[`modules/datasource/helm/index > getReleases > returns list of versions for normal response 1`] = `
{
"homepage": "https://www.getambassador.io/",
"registryUrl": "https://example-repository.com",

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/hex/index getReleases process public repo without auth 1`] = `
exports[`modules/datasource/hex/index > getReleases > process public repo without auth 1`] = `
{
"homepage": "https://hex.pm/packages/certifi",
"registryUrl": "https://hex.pm",
@ -90,7 +90,7 @@ exports[`modules/datasource/hex/index getReleases process public repo without au
}
`;
exports[`modules/datasource/hex/index getReleases processes a private repo with auth 1`] = `
exports[`modules/datasource/hex/index > getReleases > processes a private repo with auth 1`] = `
{
"homepage": "https://hex.pm/packages/renovate_test/private_package",
"registryUrl": "https://hex.pm",
@ -108,7 +108,7 @@ exports[`modules/datasource/hex/index getReleases processes a private repo with
}
`;
exports[`modules/datasource/hex/index getReleases processes real data 1`] = `
exports[`modules/datasource/hex/index > getReleases > processes real data 1`] = `
{
"homepage": "https://hex.pm/packages/certifi",
"registryUrl": "https://hex.pm",

View File

@ -9,7 +9,7 @@ import { HexDatasource } from '.';
const certifiResponse = Fixtures.get('certifi.json');
const privatePackageResponse = Fixtures.get('private_package.json');
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
const baseUrl = 'https://hex.pm/api';
const datasource = HexDatasource.id;

View File

@ -118,7 +118,7 @@ class DummyDatasource5 extends Datasource {
}
}
jest.mock('./metadata-manual', () => ({
vi.mock('./metadata-manual', () => ({
manualChangelogUrls: {
dummy: {
package: 'https://foo.bar/package/CHANGELOG.md',
@ -131,8 +131,8 @@ jest.mock('./metadata-manual', () => ({
},
}));
jest.mock('../../util/cache/package');
const packageCache = _packageCache as jest.Mocked<typeof _packageCache>;
vi.mock('../../util/cache/package');
const packageCache = vi.mocked(_packageCache);
describe('modules/datasource/index', () => {
afterEach(() => {
@ -159,7 +159,7 @@ describe('modules/datasource/index', () => {
expect(getDatasourceList()).toEqual(managerList);
});
it('validates datasource', () => {
it('validates datasource', async () => {
function validateDatasource(
module: DatasourceApi,
name: string,
@ -182,7 +182,7 @@ describe('modules/datasource/index', () => {
}
}
const loadedDs = loadModules(
const loadedDs = await loadModules(
__dirname,
validateDatasource,
filterClassBasedDatasources,

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/java-version/index getReleases pages 1`] = `
exports[`modules/datasource/java-version/index > getReleases > pages 1`] = `
{
"homepage": "https://adoptium.net",
"registryUrl": "https://api.adoptium.net/",
@ -159,7 +159,7 @@ exports[`modules/datasource/java-version/index getReleases pages 1`] = `
}
`;
exports[`modules/datasource/java-version/index getReleases processes real data (jre) 1`] = `
exports[`modules/datasource/java-version/index > getReleases > processes real data (jre) 1`] = `
{
"homepage": "https://adoptium.net",
"registryUrl": "https://api.adoptium.net/",
@ -174,7 +174,7 @@ exports[`modules/datasource/java-version/index getReleases processes real data (
}
`;
exports[`modules/datasource/java-version/index getReleases processes real data 1`] = `
exports[`modules/datasource/java-version/index > getReleases > processes real data 1`] = `
{
"homepage": "https://adoptium.net",
"registryUrl": "https://api.adoptium.net/",

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/maven/index falls back to next registry url 1`] = `
exports[`modules/datasource/maven/index > falls back to next registry url 1`] = `
{
"display": "org.example:package",
"group": "org.example",
@ -37,7 +37,7 @@ exports[`modules/datasource/maven/index falls back to next registry url 1`] = `
}
`;
exports[`modules/datasource/maven/index ignores unsupported protocols 1`] = `
exports[`modules/datasource/maven/index > ignores unsupported protocols 1`] = `
[
{
"version": "0.0.1",
@ -66,7 +66,7 @@ exports[`modules/datasource/maven/index ignores unsupported protocols 1`] = `
]
`;
exports[`modules/datasource/maven/index removes authentication header after redirect 1`] = `
exports[`modules/datasource/maven/index > removes authentication header after redirect 1`] = `
{
"display": "org.example:package",
"group": "org.example",
@ -104,7 +104,7 @@ exports[`modules/datasource/maven/index removes authentication header after redi
}
`;
exports[`modules/datasource/maven/index returns releases 1`] = `
exports[`modules/datasource/maven/index > returns releases 1`] = `
{
"display": "org.example:package",
"group": "org.example",
@ -141,7 +141,7 @@ exports[`modules/datasource/maven/index returns releases 1`] = `
}
`;
exports[`modules/datasource/maven/index returns releases from custom repository 1`] = `
exports[`modules/datasource/maven/index > returns releases from custom repository 1`] = `
{
"display": "org.example:package",
"group": "org.example",
@ -179,7 +179,7 @@ exports[`modules/datasource/maven/index returns releases from custom repository
}
`;
exports[`modules/datasource/maven/index skips registry with invalid XML 1`] = `
exports[`modules/datasource/maven/index > skips registry with invalid XML 1`] = `
{
"display": "org.example:package",
"group": "org.example",
@ -216,7 +216,7 @@ exports[`modules/datasource/maven/index skips registry with invalid XML 1`] = `
}
`;
exports[`modules/datasource/maven/index skips registry with invalid metadata structure 1`] = `
exports[`modules/datasource/maven/index > skips registry with invalid metadata structure 1`] = `
{
"display": "org.example:package",
"group": "org.example",

View File

@ -16,7 +16,7 @@ import { MAVEN_REPO } from './common';
import { MavenDatasource } from '.';
const googleAuth = mocked(_googleAuth);
jest.mock('google-auth-library');
vi.mock('google-auth-library');
const datasource = MavenDatasource.id;

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/node-version/index getReleases processes real data 1`] = `
exports[`modules/datasource/node-version/index > getReleases > processes real data 1`] = `
{
"homepage": "https://nodejs.org",
"registryUrl": "https://nodejs.org/dist",

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/npm/index should fetch package info from custom registry 1`] = `
exports[`modules/datasource/npm/index > should fetch package info from custom registry 1`] = `
{
"isPrivate": true,
"registryUrl": "https://npm.mycustomregistry.com",
@ -28,7 +28,7 @@ exports[`modules/datasource/npm/index should fetch package info from custom regi
}
`;
exports[`modules/datasource/npm/index should fetch package info from npm 1`] = `
exports[`modules/datasource/npm/index > should fetch package info from npm 1`] = `
{
"isPrivate": false,
"registryUrl": "https://registry.npmjs.org",
@ -56,7 +56,7 @@ exports[`modules/datasource/npm/index should fetch package info from npm 1`] = `
}
`;
exports[`modules/datasource/npm/index should handle foobar 1`] = `
exports[`modules/datasource/npm/index > should handle foobar 1`] = `
{
"isPrivate": true,
"registryUrl": "https://registry.npmjs.org",
@ -84,7 +84,7 @@ exports[`modules/datasource/npm/index should handle foobar 1`] = `
}
`;
exports[`modules/datasource/npm/index should handle no time 1`] = `
exports[`modules/datasource/npm/index > should handle no time 1`] = `
{
"isPrivate": true,
"registryUrl": "https://registry.npmjs.org",
@ -111,7 +111,7 @@ exports[`modules/datasource/npm/index should handle no time 1`] = `
}
`;
exports[`modules/datasource/npm/index should not send an authorization header if public package 1`] = `
exports[`modules/datasource/npm/index > should not send an authorization header if public package 1`] = `
{
"isPrivate": true,
"registryUrl": "https://registry.npmjs.org",
@ -139,7 +139,7 @@ exports[`modules/datasource/npm/index should not send an authorization header if
}
`;
exports[`modules/datasource/npm/index should parse repo url (string) 1`] = `
exports[`modules/datasource/npm/index > should parse repo url (string) 1`] = `
{
"isPrivate": true,
"registryUrl": "https://registry.npmjs.org",
@ -159,7 +159,7 @@ exports[`modules/datasource/npm/index should parse repo url (string) 1`] = `
}
`;
exports[`modules/datasource/npm/index should parse repo url 1`] = `
exports[`modules/datasource/npm/index > should parse repo url 1`] = `
{
"isPrivate": true,
"registryUrl": "https://registry.npmjs.org",
@ -179,7 +179,7 @@ exports[`modules/datasource/npm/index should parse repo url 1`] = `
}
`;
exports[`modules/datasource/npm/index should replace any environment variable in npmrc 1`] = `
exports[`modules/datasource/npm/index > should replace any environment variable in npmrc 1`] = `
{
"isPrivate": true,
"registryUrl": "https://registry.from-env.com",
@ -207,7 +207,7 @@ exports[`modules/datasource/npm/index should replace any environment variable in
}
`;
exports[`modules/datasource/npm/index should return deprecated 1`] = `
exports[`modules/datasource/npm/index > should return deprecated 1`] = `
{
"deprecationMessage": "On registry \`https://registry.npmjs.org\`, the "latest" version of dependency \`foobar\` has the following deprecation notice:
@ -241,7 +241,7 @@ Marking the latest version of an npm package as deprecated results in the entire
}
`;
exports[`modules/datasource/npm/index should return deprecated 2`] = `
exports[`modules/datasource/npm/index > should return deprecated 2`] = `
"On registry \`https://registry.npmjs.org\`, the "latest" version of dependency \`foobar\` has the following deprecation notice:
\`This is deprecated\`
@ -249,7 +249,7 @@ exports[`modules/datasource/npm/index should return deprecated 2`] = `
Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake."
`;
exports[`modules/datasource/npm/index should send an authorization header if provided 1`] = `
exports[`modules/datasource/npm/index > should send an authorization header if provided 1`] = `
{
"isPrivate": true,
"registryUrl": "https://registry.npmjs.org",
@ -277,7 +277,7 @@ exports[`modules/datasource/npm/index should send an authorization header if pro
}
`;
exports[`modules/datasource/npm/index should use default registry if missing from npmrc 1`] = `
exports[`modules/datasource/npm/index > should use default registry if missing from npmrc 1`] = `
{
"isPrivate": true,
"registryUrl": "https://registry.npmjs.org",
@ -305,7 +305,7 @@ exports[`modules/datasource/npm/index should use default registry if missing fro
}
`;
exports[`modules/datasource/npm/index should use host rules by baseUrl if provided 1`] = `
exports[`modules/datasource/npm/index > should use host rules by baseUrl if provided 1`] = `
{
"isPrivate": true,
"registryUrl": "https://npm.mycustomregistry.com/_packaging/mycustomregistry/npm/registry",
@ -333,7 +333,7 @@ exports[`modules/datasource/npm/index should use host rules by baseUrl if provid
}
`;
exports[`modules/datasource/npm/index should use host rules by hostName if provided 1`] = `
exports[`modules/datasource/npm/index > should use host rules by hostName if provided 1`] = `
{
"isPrivate": true,
"registryUrl": "https://npm.mycustomregistry.com",

View File

@ -7,7 +7,7 @@ import { Http } from '../../../util/http';
import { CACHE_REVISION, getDependency } from './get';
import { resolveRegistryUrl, setNpmrc } from './npmrc';
jest.mock('../../../util/cache/package');
vi.mock('../../../util/cache/package');
const packageCache = mocked(_packageCache);

View File

@ -8,7 +8,7 @@ import {
setNpmrc,
} from './npmrc';
jest.mock('../../../util/sanitize');
vi.mock('../../../util/sanitize');
const sanitize = mocked(_sanitize);

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/nuget/index getReleases handles paginated results (v2) 1`] = `
exports[`modules/datasource/nuget/index > getReleases > handles paginated results (v2) 1`] = `
{
"registryUrl": "https://www.nuget.org/api/v2",
"releases": [
@ -17,7 +17,7 @@ exports[`modules/datasource/nuget/index getReleases handles paginated results (v
}
`;
exports[`modules/datasource/nuget/index getReleases processes real data (v2) 1`] = `
exports[`modules/datasource/nuget/index > getReleases > processes real data (v2) 1`] = `
{
"registryUrl": "https://www.nuget.org/api/v2",
"releases": [
@ -208,7 +208,7 @@ exports[`modules/datasource/nuget/index getReleases processes real data (v2) 1`]
}
`;
exports[`modules/datasource/nuget/index getReleases processes real data (v3) feed is a nuget.org 1`] = `
exports[`modules/datasource/nuget/index > getReleases > processes real data (v3) feed is a nuget.org 1`] = `
{
"homepage": "https://nunit.org/",
"registryUrl": "https://api.nuget.org/v3/index.json",
@ -398,7 +398,7 @@ exports[`modules/datasource/nuget/index getReleases processes real data (v3) fee
}
`;
exports[`modules/datasource/nuget/index getReleases processes real data (v3) feed is not a nuget.org 1`] = `
exports[`modules/datasource/nuget/index > getReleases > processes real data (v3) feed is not a nuget.org 1`] = `
{
"registryUrl": "https://myprivatefeed/index.json",
"releases": [
@ -586,7 +586,7 @@ exports[`modules/datasource/nuget/index getReleases processes real data (v3) fee
}
`;
exports[`modules/datasource/nuget/index getReleases processes real data (v3) for several catalog pages 1`] = `
exports[`modules/datasource/nuget/index > getReleases > processes real data (v3) for several catalog pages 1`] = `
{
"homepage": "https://nlog-project.org/",
"registryUrl": "https://api.nuget.org/v3/index.json",
@ -1220,7 +1220,7 @@ exports[`modules/datasource/nuget/index getReleases processes real data (v3) for
}
`;
exports[`modules/datasource/nuget/index getReleases processes real data (v3) nuspec fetch 404 error 1`] = `
exports[`modules/datasource/nuget/index > getReleases > processes real data (v3) nuspec fetch 404 error 1`] = `
{
"registryUrl": "https://api.nuget.org/v3/index.json",
"releases": [
@ -1409,7 +1409,7 @@ exports[`modules/datasource/nuget/index getReleases processes real data (v3) nus
}
`;
exports[`modules/datasource/nuget/index getReleases processes real data (v3) nuspec fetch error 1`] = `
exports[`modules/datasource/nuget/index > getReleases > processes real data (v3) nuspec fetch error 1`] = `
{
"registryUrl": "https://api.nuget.org/v3/index.json",
"releases": [
@ -1598,7 +1598,7 @@ exports[`modules/datasource/nuget/index getReleases processes real data (v3) nus
}
`;
exports[`modules/datasource/nuget/index getReleases processes real data with no github project url (v2) 1`] = `
exports[`modules/datasource/nuget/index > getReleases > processes real data with no github project url (v2) 1`] = `
{
"registryUrl": "https://www.nuget.org/api/v2",
"releases": [
@ -1613,7 +1613,7 @@ exports[`modules/datasource/nuget/index getReleases processes real data with no
}
`;
exports[`modules/datasource/nuget/index getReleases processes real data without project url (v2) 1`] = `
exports[`modules/datasource/nuget/index > getReleases > processes real data without project url (v2) 1`] = `
{
"registryUrl": "https://www.nuget.org/api/v2",
"releases": [
@ -1753,7 +1753,7 @@ exports[`modules/datasource/nuget/index getReleases processes real data without
}
`;
exports[`modules/datasource/nuget/index getReleases returns deduplicated results 1`] = `
exports[`modules/datasource/nuget/index > getReleases > returns deduplicated results 1`] = `
{
"homepage": "https://nunit.org/",
"releases": [

View File

@ -1,7 +1,7 @@
import { sortNugetVersions } from './common';
describe('modules/datasource/nuget/common', () => {
it.each<{ version: string; other: string; result: number }>`
it.each`
version | other | result
${'invalid1'} | ${'invalid2'} | ${0}
${'invalid'} | ${'1.0.0'} | ${-1}
@ -11,7 +11,15 @@ describe('modules/datasource/nuget/common', () => {
${'1.0.0'} | ${'1.0.0'} | ${0}
`(
'sortNugetVersions("$version", "$other") === $result',
({ version, other, result }) => {
({
version,
other,
result,
}: {
version: string;
other: string;
result: number;
}) => {
const res = sortNugetVersions(version, other);
expect(res).toBe(result);
},

View File

@ -16,9 +16,9 @@ const datasource = NugetDatasource.id;
const hostRules: any = _hostRules;
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
jest.mock('../../../util/cache/package', () => mockDeep());
vi.mock('../../../util/cache/package', () => mockDeep());
const packageCache = mocked(_packageCache);
const pkgInfoV3FromNuget = Fixtures.get('nunit/v3_nuget_org.xml');

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/orb/index getReleases processes homeUrl 1`] = `
exports[`modules/datasource/orb/index > getReleases > processes homeUrl 1`] = `
{
"homepage": "https://google.com",
"isPrivate": false,
@ -49,7 +49,7 @@ exports[`modules/datasource/orb/index getReleases processes homeUrl 1`] = `
}
`;
exports[`modules/datasource/orb/index getReleases processes real data 1`] = `
exports[`modules/datasource/orb/index > getReleases > processes real data 1`] = `
{
"homepage": "https://circleci.com/developer/orbs/orb/hyper-expanse/library-release-workflows",
"isPrivate": false,

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/packagist/index getReleases adds packagist source implicitly 1`] = `
exports[`modules/datasource/packagist/index > getReleases > adds packagist source implicitly 1`] = `
{
"registryUrl": "https://packagist.org",
"releases": [
@ -104,7 +104,7 @@ exports[`modules/datasource/packagist/index getReleases adds packagist source im
}
`;
exports[`modules/datasource/packagist/index getReleases processes real versioned data 1`] = `
exports[`modules/datasource/packagist/index > getReleases > processes real versioned data 1`] = `
{
"registryUrl": "https://packagist.org",
"releases": [
@ -208,7 +208,7 @@ exports[`modules/datasource/packagist/index getReleases processes real versioned
}
`;
exports[`modules/datasource/packagist/index getReleases supports includes packages 1`] = `
exports[`modules/datasource/packagist/index > getReleases > supports includes packages 1`] = `
{
"homepage": "http://guzzlephp.org/",
"registryUrl": "https://composer.renovatebot.com",
@ -353,7 +353,7 @@ exports[`modules/datasource/packagist/index getReleases supports includes packag
}
`;
exports[`modules/datasource/packagist/index getReleases supports lazy repositories 1`] = `
exports[`modules/datasource/packagist/index > getReleases > supports lazy repositories 1`] = `
{
"registryUrl": "https://composer.renovatebot.com/composer/lazy",
"releases": [
@ -369,7 +369,7 @@ exports[`modules/datasource/packagist/index getReleases supports lazy repositori
}
`;
exports[`modules/datasource/packagist/index getReleases supports plain packages 1`] = `
exports[`modules/datasource/packagist/index > getReleases > supports plain packages 1`] = `
{
"registryUrl": "https://composer.renovatebot.com",
"releases": [
@ -389,7 +389,7 @@ exports[`modules/datasource/packagist/index getReleases supports plain packages
}
`;
exports[`modules/datasource/packagist/index getReleases supports provider-includes 1`] = `
exports[`modules/datasource/packagist/index > getReleases > supports provider-includes 1`] = `
{
"homepage": "https://wordpress.org/plugins/1beyt/",
"registryUrl": "https://composer.renovatebot.com",
@ -419,7 +419,7 @@ exports[`modules/datasource/packagist/index getReleases supports provider-includ
}
`;
exports[`modules/datasource/packagist/index getReleases supports providers 1`] = `
exports[`modules/datasource/packagist/index > getReleases > supports providers 1`] = `
{
"homepage": "https://wordpress.org/plugins/1beyt/",
"registryUrl": "https://composer.renovatebot.com",
@ -449,7 +449,7 @@ exports[`modules/datasource/packagist/index getReleases supports providers 1`] =
}
`;
exports[`modules/datasource/packagist/index getReleases supports providers without a hash 1`] = `
exports[`modules/datasource/packagist/index > getReleases > supports providers without a hash 1`] = `
{
"homepage": "https://wordpress.org/plugins/1beyt/",
"registryUrl": "https://composer.renovatebot.com",

View File

@ -8,7 +8,7 @@ import * as composerVersioning from '../../versioning/composer';
import { id as versioning } from '../../versioning/loose';
import { PackagistDatasource } from '.';
jest.mock('../../../util/host-rules', () => mockDeep());
vi.mock('../../../util/host-rules', () => mockDeep());
const hostRules = _hostRules;
@ -144,7 +144,7 @@ describe('modules/datasource/packagist/index', () => {
});
it('supports includes packages', async () => {
hostRules.find = jest.fn(() => ({
hostRules.find = vi.fn(() => ({
username: 'some-username',
password: 'some-password',
}));
@ -177,7 +177,7 @@ describe('modules/datasource/packagist/index', () => {
});
it('supports older sha1 hashes', async () => {
hostRules.find = jest.fn(() => ({
hostRules.find = vi.fn(() => ({
username: 'some-username',
password: 'some-password',
}));

View File

@ -11,7 +11,7 @@ import type {
ReleaseResult,
} from './types';
jest.mock('./common');
vi.mock('./common');
const { getDatasourceFor } = mocked(_datasourceCommon);
class DummyDatasource extends Datasource {

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/pypi/index getReleases parses data-requires-python and respects constraints from simple endpoint 1`] = `
exports[`modules/datasource/pypi/index > getReleases > parses data-requires-python and respects constraints from simple endpoint 1`] = `
{
"registryUrl": "https://some.registry.org/simple",
"releases": [
@ -26,7 +26,7 @@ exports[`modules/datasource/pypi/index getReleases parses data-requires-python a
}
`;
exports[`modules/datasource/pypi/index getReleases process data from +simple endpoint 1`] = `
exports[`modules/datasource/pypi/index > getReleases > process data from +simple endpoint 1`] = `
{
"registryUrl": "https://some.registry.org/+simple",
"releases": [
@ -68,7 +68,7 @@ exports[`modules/datasource/pypi/index getReleases process data from +simple end
}
`;
exports[`modules/datasource/pypi/index getReleases process data from simple endpoint 1`] = `
exports[`modules/datasource/pypi/index > getReleases > process data from simple endpoint 1`] = `
{
"registryUrl": "https://some.registry.org/simple",
"releases": [
@ -110,7 +110,7 @@ exports[`modules/datasource/pypi/index getReleases process data from simple endp
}
`;
exports[`modules/datasource/pypi/index getReleases process data from simple endpoint with hyphens replaced with underscores 1`] = `
exports[`modules/datasource/pypi/index > getReleases > process data from simple endpoint with hyphens replaced with underscores 1`] = `
{
"registryUrl": "https://some.registry.org/simple",
"releases": [
@ -121,7 +121,7 @@ exports[`modules/datasource/pypi/index getReleases process data from simple endp
}
`;
exports[`modules/datasource/pypi/index getReleases processes real data 1`] = `
exports[`modules/datasource/pypi/index > getReleases > processes real data 1`] = `
{
"registryUrl": "https://pypi.org/pypi",
"releases": [
@ -219,7 +219,7 @@ exports[`modules/datasource/pypi/index getReleases processes real data 1`] = `
}
`;
exports[`modules/datasource/pypi/index getReleases respects constraints 1`] = `
exports[`modules/datasource/pypi/index > getReleases > respects constraints 1`] = `
{
"registryUrl": "https://pypi.org/pypi",
"releases": [
@ -236,7 +236,7 @@ exports[`modules/datasource/pypi/index getReleases respects constraints 1`] = `
}
`;
exports[`modules/datasource/pypi/index uses https://pypi.org/pypi/ instead of https://pypi.org/simple/ 1`] = `
exports[`modules/datasource/pypi/index > uses https://pypi.org/pypi/ instead of https://pypi.org/simple/ 1`] = `
{
"registryUrl": "https://pypi.org/simple",
"releases": [

View File

@ -7,7 +7,7 @@ import * as hostRules from '../../../util/host-rules';
import { PypiDatasource } from '.';
const googleAuth = mocked(_googleAuth);
jest.mock('google-auth-library');
vi.mock('google-auth-library');
const res1 = Fixtures.get('azure-cli-monitor.json');
const htmlResponse = Fixtures.get('versions-html.html');

View File

@ -8,7 +8,7 @@ New datasources _must_ follow the class-based programming style.
Use the `java-version` datasource as a reference.
Add the datasource to the API in [`api.ts`](api.ts) so that the new datasource is usable.
If you find `Unused HTTP mocks` errors in the Jest tests _and_ your mocked URLs are correct, make sure the datasource is correctly registered.
If you find `Unused HTTP mocks` errors in the Vitest tests _and_ your mocked URLs are correct, make sure the datasource is correctly registered.
## getReleases

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/repology/index getReleases returns correct version for api package 1`] = `
exports[`modules/datasource/repology/index > getReleases > returns correct version for api package 1`] = `
{
"registryUrl": "https://repology.org",
"releases": [
@ -11,7 +11,7 @@ exports[`modules/datasource/repology/index getReleases returns correct version f
}
`;
exports[`modules/datasource/repology/index getReleases returns correct version for binary package 1`] = `
exports[`modules/datasource/repology/index > getReleases > returns correct version for binary package 1`] = `
{
"registryUrl": "https://repology.org",
"releases": [
@ -22,7 +22,7 @@ exports[`modules/datasource/repology/index getReleases returns correct version f
}
`;
exports[`modules/datasource/repology/index getReleases returns correct version for multi-package project with different name 1`] = `
exports[`modules/datasource/repology/index > getReleases > returns correct version for multi-package project with different name 1`] = `
{
"registryUrl": "https://repology.org",
"releases": [
@ -33,7 +33,7 @@ exports[`modules/datasource/repology/index getReleases returns correct version f
}
`;
exports[`modules/datasource/repology/index getReleases returns correct version for multi-package project with same name 1`] = `
exports[`modules/datasource/repology/index > getReleases > returns correct version for multi-package project with same name 1`] = `
{
"registryUrl": "https://repology.org",
"releases": [
@ -44,7 +44,7 @@ exports[`modules/datasource/repology/index getReleases returns correct version f
}
`;
exports[`modules/datasource/repology/index getReleases returns correct version for source package 1`] = `
exports[`modules/datasource/repology/index > getReleases > returns correct version for source package 1`] = `
{
"registryUrl": "https://repology.org",
"releases": [
@ -55,7 +55,7 @@ exports[`modules/datasource/repology/index getReleases returns correct version f
}
`;
exports[`modules/datasource/repology/index getReleases returns multiple versions if they are present in repository 1`] = `
exports[`modules/datasource/repology/index > getReleases > returns multiple versions if they are present in repository 1`] = `
{
"registryUrl": "https://repology.org",
"releases": [

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/ruby-version/index getReleases parses real data 1`] = `
exports[`modules/datasource/ruby-version/index > getReleases > parses real data 1`] = `
{
"homepage": "https://www.ruby-lang.org",
"registryUrl": "https://www.ruby-lang.org/",

View File

@ -4,7 +4,7 @@ import * as _packageCache from '../../../util/cache/package';
import { Http } from '../../../util/http';
import { MetadataCache } from './metadata-cache';
jest.mock('../../../util/cache/package');
vi.mock('../../../util/cache/package');
const packageCache = mocked(_packageCache);
describe('modules/datasource/rubygems/metadata-cache', () => {

View File

@ -81,11 +81,11 @@ describe('modules/datasource/rubygems/versions-endpoint-cache', () => {
describe('Delta sync', () => {
beforeAll(() => {
jest.useFakeTimers({ advanceTimers: true });
vi.useFakeTimers({ shouldAdvanceTime: true });
});
beforeEach(() => {
jest.setSystemTime(new Date('2021-05-04T00:00:00.000Z'));
vi.setSystemTime(new Date('2021-05-04T00:00:00.000Z'));
});
it('refreshes after 15 minutes', async () => {
@ -94,7 +94,7 @@ describe('modules/datasource/rubygems/versions-endpoint-cache', () => {
const res1 = await rubygems.getVersions(registryUrl, 'foo');
expect(res1.unwrap().val).toEqual(['1.1.1']);
jest.advanceTimersByTime(15 * 60 * 1000);
vi.advanceTimersByTime(15 * 60 * 1000);
httpMock
.scope(registryUrl)
.get('/versions')
@ -120,7 +120,7 @@ describe('modules/datasource/rubygems/versions-endpoint-cache', () => {
const res1 = await rubygems.getVersions(registryUrl, 'foo');
expect(res1.unwrap().val).toEqual(['1.1.1']);
jest.advanceTimersByTime(15 * 60 * 1000);
vi.advanceTimersByTime(15 * 60 * 1000);
httpMock
.scope(registryUrl)
.get('/versions')
@ -157,7 +157,7 @@ describe('modules/datasource/rubygems/versions-endpoint-cache', () => {
const res1 = await rubygems.getVersions(registryUrl, 'foo');
expect(res1.unwrap().val).toEqual(['1.1.1']);
jest.advanceTimersByTime(15 * 60 * 1000);
vi.advanceTimersByTime(15 * 60 * 1000);
httpMock
.scope(registryUrl)
.get('/versions')
@ -180,7 +180,7 @@ describe('modules/datasource/rubygems/versions-endpoint-cache', () => {
await rubygems.getVersions(registryUrl, 'foo');
jest.advanceTimersByTime(15 * 60 * 1000);
vi.advanceTimersByTime(15 * 60 * 1000);
});
it('handles 404', async () => {

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/sbt-package/index parses Maven index directory 1`] = `
exports[`modules/datasource/sbt-package/index > parses Maven index directory 1`] = `
[
"autofix-3.0.6_2.11",
"autofix-3.0.6_2.12",
@ -188,7 +188,7 @@ exports[`modules/datasource/sbt-package/index parses Maven index directory 1`] =
]
`;
exports[`modules/datasource/sbt-package/index parses sbt index directory 1`] = `
exports[`modules/datasource/sbt-package/index > parses sbt index directory 1`] = `
[
"au.com.onegeek",
"bavadim",

View File

@ -10,7 +10,7 @@ import { MAVEN_REPO } from '../maven/common';
import { extractPageLinks } from './util';
import { SbtPackageDatasource } from '.';
jest.mock('../../../util/cache/package');
vi.mock('../../../util/cache/package');
const packageCache = mocked(_packageCache);
describe('modules/datasource/sbt-package/index', () => {

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`modules/datasource/sbt-plugin/index parses Maven index directory 1`] = `
exports[`modules/datasource/sbt-plugin/index > parses Maven index directory 1`] = `
[
"autofix-3.0.6_2.11",
"autofix-3.0.6_2.12",
@ -188,7 +188,7 @@ exports[`modules/datasource/sbt-plugin/index parses Maven index directory 1`] =
]
`;
exports[`modules/datasource/sbt-plugin/index parses sbt index directory 1`] = `
exports[`modules/datasource/sbt-plugin/index > parses sbt index directory 1`] = `
[
"au.com.onegeek",
"bavadim",

Some files were not shown because too many files have changed in this diff Show More