Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low hanging fruit of onboarding to ensureNoDisposablesAreLeakedInTestSuite #200100

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@
"src/vs/base/test/common/strings.test.ts",
"src/vs/base/test/common/stripComments.test.ts",
"src/vs/base/test/common/ternarySearchtree.test.ts",
"src/vs/base/test/common/tfIdf.test.ts",
"src/vs/base/test/common/types.test.ts",
"src/vs/base/test/common/uri.test.ts",
"src/vs/base/test/common/uuid.test.ts",
Expand All @@ -208,7 +207,6 @@
"src/vs/base/test/node/id.test.ts",
"src/vs/base/test/node/nodeStreams.test.ts",
"src/vs/base/test/node/port.test.ts",
"src/vs/base/test/node/powershell.test.ts",
"src/vs/base/test/node/snapshot.test.ts",
"src/vs/base/test/node/unc.test.ts",
"src/vs/code/test/electron-sandbox/issue/testReporterModel.test.ts",
Expand Down Expand Up @@ -319,7 +317,6 @@
"src/vs/workbench/contrib/tasks/test/common/taskConfiguration.test.ts",
"src/vs/workbench/contrib/terminal/test/browser/terminalActions.test.ts",
"src/vs/workbench/contrib/themes/test/node/colorRegistryExport.test.ts",
"src/vs/workbench/contrib/url/test/browser/trustedDomains.test.ts",
"src/vs/workbench/contrib/welcomeGettingStarted/test/browser/gettingStartedMarkdownRenderer.test.ts",
"src/vs/workbench/services/commands/test/common/commandService.test.ts",
"src/vs/workbench/services/configuration/test/common/configurationModels.test.ts",
Expand Down
2 changes: 2 additions & 0 deletions src/vs/base/test/common/tfIdf.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import * as assert from 'assert';
import { CancellationToken } from 'vs/base/common/cancellation';
import { TfIdfCalculator, TfIdfDocument, TfIdfScore } from 'vs/base/common/tfIdf';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';

/**
* Generates all permutations of an array.
Expand Down Expand Up @@ -39,6 +40,7 @@ function assertScoreOrdersEqual(actualScores: TfIdfScore[], expectedScoreKeys: s
}

suite('TF-IDF Calculator', function () {
ensureNoDisposablesAreLeakedInTestSuite();
test('Should return no scores when no documents are given', () => {
const tfidf = new TfIdfCalculator();
const scores = tfidf.calculateScores('something', CancellationToken.None);
Expand Down
3 changes: 2 additions & 1 deletion src/vs/base/test/node/powershell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as assert from 'assert';
import * as fs from 'fs';
import * as platform from 'vs/base/common/platform';
import { enumeratePowerShellInstallations, getFirstAvailablePowerShellInstallation, IPowerShellExeDetails } from 'vs/base/node/powershell';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';

function checkPath(exePath: string) {
// Check to see if the path exists
Expand All @@ -28,7 +29,7 @@ function checkPath(exePath: string) {

if (platform.isWindows) {
suite('PowerShell finder', () => {

ensureNoDisposablesAreLeakedInTestSuite();
test('Can find first available PowerShell', async () => {
const pwshExe = await getFirstAvailablePowerShellInstallation();
const exePath = pwshExe?.exePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as assert from 'assert';
import { isURLDomainTrusted } from 'vs/workbench/contrib/url/browser/trustedDomainsValidator';
import { URI } from 'vs/base/common/uri';
import { extractGitHubRemotesFromGitConfig } from 'vs/workbench/contrib/url/browser/trustedDomains';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';

function linkAllowedByRules(link: string, rules: string[]) {
assert.ok(isURLDomainTrusted(URI.parse(link), rules), `Link\n${link}\n should be allowed by rules\n${JSON.stringify(rules)}`);
Expand All @@ -17,6 +18,7 @@ function linkNotAllowedByRules(link: string, rules: string[]) {
}

suite('GitHub remote extraction', () => {
ensureNoDisposablesAreLeakedInTestSuite();
test('All known formats', () => {
assert.deepStrictEqual(
extractGitHubRemotesFromGitConfig(
Expand All @@ -39,6 +41,7 @@ suite('GitHub remote extraction', () => {
});

suite('Link protection domain matching', () => {
ensureNoDisposablesAreLeakedInTestSuite();
test('simple', () => {
linkNotAllowedByRules('https://x.org', []);

Expand Down