test(dev-infra): fix test order failure in tests for the release command (#41023)

Depending on test order, the `_npmPackageInfoCache` contains information
which causes the prompt results to be slightly different text.

PR Close #41023
This commit is contained in:
Joey Perrott 2021-02-26 16:34:27 -08:00 committed by Andrew Kushnir
parent 03d47d5701
commit 153e3a8960
1 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import {join} from 'path';
import * as semver from 'semver'; import * as semver from 'semver';
import {getBranchPushMatcher} from '../../../utils/testing'; import {getBranchPushMatcher} from '../../../utils/testing';
import {_npmPackageInfoCache} from '../../versioning';
import {ActiveReleaseTrains} from '../../versioning/active-release-trains'; import {ActiveReleaseTrains} from '../../versioning/active-release-trains';
import * as npm from '../../versioning/npm-publish'; import * as npm from '../../versioning/npm-publish';
import {ReleaseTrain} from '../../versioning/release-trains'; import {ReleaseTrain} from '../../versioning/release-trains';
@ -35,6 +36,13 @@ describe('common release action logic', () => {
}; };
it('should not modify release train versions and cause invalid other actions', async () => { it('should not modify release train versions and cause invalid other actions', async () => {
// The cached npm package information needs to be deleted as depending on the test order
// their may or may not be packages in the cache, causing the number of active LTS branches
// in this test to be 2 instead of 0.
for (const packageName in _npmPackageInfoCache) {
delete _npmPackageInfoCache[packageName];
}
const {releaseConfig, gitClient} = getTestingMocksForReleaseAction(); const {releaseConfig, gitClient} = getTestingMocksForReleaseAction();
const descriptions: string[] = []; const descriptions: string[] = [];