Skip to content

Commit 483ee59

Browse files
authored
Replace deprecated assert.* with strict versions (#18168)
1 parent 07faa94 commit 483ee59

49 files changed

Lines changed: 490 additions & 474 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/test/api.functional.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,6 @@ suite('Extension API', () => {
114114
instance(serviceContainer),
115115
).debug.getDebuggerPackagePath();
116116

117-
assert.equal(pkgPath, debuggerPath);
117+
assert.strictEqual(pkgPath, debuggerPath);
118118
});
119119
});

src/test/application/diagnostics/applicationDiagnostics.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ suite('Application Diagnostics - ApplicationDiagnostics', () => {
246246
verify(foreGroundService.runInBackground).atLeast(1);
247247
verify(backGroundService.runInBackground).atLeast(1);
248248

249-
assert.equal(deferred.completed, false);
249+
assert.strictEqual(deferred.completed, false);
250250
foreGroundDeferred.resolve([]);
251251
await sleep(1);
252252

253-
assert.equal(deferred.completed, true);
253+
assert.strictEqual(deferred.completed, true);
254254

255255
backgroundGroundDeferred.resolve([]);
256256
await sleep(1);

src/test/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,8 @@ export class FakeClock {
627627
* const handler = new TestEventHandler(xyz.onDidSave);
628628
* // Do something that would trigger the event.
629629
* assert.ok(handler.fired)
630-
* assert.equal(handler.first, 'Args Passed to first onDidSave')
631-
* assert.equal(handler.count, 1)// Only one should have been fired.
630+
* assert.strictEqual(handler.first, 'Args Passed to first onDidSave')
631+
* assert.strictEqual(handler.count, 1)// Only one should have been fired.
632632
*/
633633
export class TestEventHandler<T extends void | any = any> implements IDisposable {
634634
public get fired() {

src/test/common/configSettings.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ suite('Configuration Settings', () => {
2828

2929
const pythonSettingValue = (pythonSettings as any)[key] as string;
3030
if (key.endsWith('Path') && IS_WINDOWS) {
31-
assert.equal(
31+
assert.strictEqual(
3232
settingValue.toUpperCase(),
3333
pythonSettingValue.toUpperCase(),
3434
`Setting ${key} not the same`,

src/test/common/experiments/telemetry.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ suite('Experimentation telemetry', () => {
4242
experimentTelemetry.postEvent(event, eventProperties);
4343

4444
sinon.assert.calledOnce(sendTelemetryEventStub);
45-
assert.equal(telemetryEvents.length, 1);
45+
assert.strictEqual(telemetryEvents.length, 1);
4646
assert.deepEqual(telemetryEvents[0], {
4747
eventName: event,
4848
properties: {

src/test/common/helpers.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import { isNotInstalledError } from '../../client/common/helpers';
88
suite('helpers', () => {
99
test('isNotInstalledError', (done) => {
1010
const error = new Error('something is not installed');
11-
assert.equal(isNotInstalledError(error), false, 'Standard error');
11+
assert.strictEqual(isNotInstalledError(error), false, 'Standard error');
1212

1313
(error as any).code = 'ENOENT';
14-
assert.equal(isNotInstalledError(error), true, 'ENOENT error code not detected');
14+
assert.strictEqual(isNotInstalledError(error), true, 'ENOENT error code not detected');
1515

1616
(error as any).code = 127;
17-
assert.equal(isNotInstalledError(error), true, '127 error code not detected');
17+
assert.strictEqual(isNotInstalledError(error), true, '127 error code not detected');
1818

1919
done();
2020
});

src/test/common/insidersBuild/downloadChannelRules.unit.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ suite('Download channel rules - ExtensionInsidersOffChannelRule', () => {
2525

2626
test('Never look for insiders build', async () => {
2727
const result = await stableChannelRule.shouldLookForInsidersBuild();
28-
assert.equal(result, false, 'Not looking for the correct build');
28+
assert.strictEqual(result, false, 'Not looking for the correct build');
2929
});
3030
});
3131

@@ -49,7 +49,7 @@ suite('Download channel rules - ExtensionInsidersDailyChannelRule', () => {
4949
.verifiable(TypeMoq.Times.once());
5050
const result = await insidersDailyChannelRule.shouldLookForInsidersBuild(true);
5151
lastLookUpTime.verifyAll();
52-
assert.equal(result, true, 'Not looking for the correct build');
52+
assert.strictEqual(result, true, 'Not looking for the correct build');
5353
});
5454
suite('If insiders channel rule is not new', async () => {
5555
test('Update look up time and return installer for insiders build if looking for insiders the first time', async () => {
@@ -63,7 +63,7 @@ suite('Download channel rules - ExtensionInsidersDailyChannelRule', () => {
6363
.verifiable(TypeMoq.Times.atLeastOnce());
6464
const result = await insidersDailyChannelRule.shouldLookForInsidersBuild(false);
6565
lastLookUpTime.verifyAll();
66-
assert.equal(result, true, 'Not looking for the correct build');
66+
assert.strictEqual(result, true, 'Not looking for the correct build');
6767
});
6868
test('Update look up time and return installer for insiders build if looking for insiders after 24 hrs of last lookup time', async () => {
6969
lastLookUpTime
@@ -76,7 +76,7 @@ suite('Download channel rules - ExtensionInsidersDailyChannelRule', () => {
7676
.verifiable(TypeMoq.Times.atLeastOnce());
7777
const result = await insidersDailyChannelRule.shouldLookForInsidersBuild(false);
7878
lastLookUpTime.verifyAll();
79-
assert.equal(result, true, 'Not looking for the correct build');
79+
assert.strictEqual(result, true, 'Not looking for the correct build');
8080
});
8181
test('Do not update look up time or return any installer if looking for insiders within 24 hrs of last lookup time', async () => {
8282
lastLookUpTime
@@ -89,7 +89,7 @@ suite('Download channel rules - ExtensionInsidersDailyChannelRule', () => {
8989
.verifiable(TypeMoq.Times.atLeastOnce());
9090
const result = await insidersDailyChannelRule.shouldLookForInsidersBuild(false);
9191
lastLookUpTime.verifyAll();
92-
assert.equal(result, false, 'Not looking for the correct build');
92+
assert.strictEqual(result, false, 'Not looking for the correct build');
9393
});
9494
});
9595
});
@@ -114,7 +114,7 @@ suite('Download channel rules - ExtensionInsidersWeeklyChannelRule', () => {
114114
.verifiable(TypeMoq.Times.once());
115115
const result = await insidersWeeklyChannelRule.shouldLookForInsidersBuild(true);
116116
lastLookUpTime.verifyAll();
117-
assert.equal(result, true, 'Not looking for the correct build');
117+
assert.strictEqual(result, true, 'Not looking for the correct build');
118118
});
119119
suite('If insiders channel rule is not new', async () => {
120120
test('Update look up time and return installer for insiders build if looking for insiders the first time', async () => {
@@ -128,7 +128,7 @@ suite('Download channel rules - ExtensionInsidersWeeklyChannelRule', () => {
128128
.verifiable(TypeMoq.Times.atLeastOnce());
129129
const result = await insidersWeeklyChannelRule.shouldLookForInsidersBuild(false);
130130
lastLookUpTime.verifyAll();
131-
assert.equal(result, true, 'Not looking for the correct build');
131+
assert.strictEqual(result, true, 'Not looking for the correct build');
132132
});
133133
test('Update look up time and return installer for insiders build if looking for insiders after a week of last lookup time', async () => {
134134
lastLookUpTime
@@ -141,7 +141,7 @@ suite('Download channel rules - ExtensionInsidersWeeklyChannelRule', () => {
141141
.verifiable(TypeMoq.Times.atLeastOnce());
142142
const result = await insidersWeeklyChannelRule.shouldLookForInsidersBuild(false);
143143
lastLookUpTime.verifyAll();
144-
assert.equal(result, true, 'Not looking for the correct build');
144+
assert.strictEqual(result, true, 'Not looking for the correct build');
145145
});
146146
test('Do not update look up time or return any installer if looking for insiders within one week of last lookup time', async () => {
147147
lastLookUpTime
@@ -154,7 +154,7 @@ suite('Download channel rules - ExtensionInsidersWeeklyChannelRule', () => {
154154
.verifiable(TypeMoq.Times.atLeastOnce());
155155
const result = await insidersWeeklyChannelRule.shouldLookForInsidersBuild(false);
156156
lastLookUpTime.verifyAll();
157-
assert.equal(result, false, 'Not looking for the correct build');
157+
assert.strictEqual(result, false, 'Not looking for the correct build');
158158
});
159159
});
160160
});

src/test/common/insidersBuild/insidersExtensionService.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ suite('Insiders Extension Service - Activation', () => {
199199
await sleep(1);
200200

201201
// Ensure activate() function has completed while handleChannel is still running
202-
assert.equal(deferred.completed, true);
202+
assert.strictEqual(deferred.completed, true);
203203

204204
handleChannelsDeferred.resolve();
205205
await sleep(1);

src/test/common/installer/condaInstaller.unit.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,25 @@ suite('Common - Conda Installer', () => {
3939
installer = new CondaInstallerTest(instance(serviceContainer));
4040
});
4141
test('Name and priority', async () => {
42-
assert.equal(installer.displayName, 'Conda');
43-
assert.equal(installer.name, 'Conda');
44-
assert.equal(installer.priority, 0);
42+
assert.strictEqual(installer.displayName, 'Conda');
43+
assert.strictEqual(installer.name, 'Conda');
44+
assert.strictEqual(installer.priority, 0);
4545
});
4646
test('Installer is not supported when conda is available variable is set to false', async () => {
4747
const uri = Uri.file(__filename);
4848
installer._isCondaAvailable = false;
4949

5050
const supported = await installer.isSupported(uri);
5151

52-
assert.equal(supported, false);
52+
assert.strictEqual(supported, false);
5353
});
5454
test('Installer is not supported when conda is not available', async () => {
5555
const uri = Uri.file(__filename);
5656
when(condaService.isCondaAvailable()).thenResolve(false);
5757

5858
const supported = await installer.isSupported(uri);
5959

60-
assert.equal(supported, false);
60+
assert.strictEqual(supported, false);
6161
});
6262
test('Installer is not supported when current env is not a conda env', async () => {
6363
const uri = Uri.file(__filename);
@@ -71,7 +71,7 @@ suite('Common - Conda Installer', () => {
7171

7272
const supported = await installer.isSupported(uri);
7373

74-
assert.equal(supported, false);
74+
assert.strictEqual(supported, false);
7575
});
7676
test('Installer is supported when current env is a conda env', async () => {
7777
const uri = Uri.file(__filename);
@@ -85,7 +85,7 @@ suite('Common - Conda Installer', () => {
8585

8686
const supported = await installer.isSupported(uri);
8787

88-
assert.equal(supported, true);
88+
assert.strictEqual(supported, true);
8989
});
9090
test('Include name of environment', async () => {
9191
const uri = Uri.file(__filename);

src/test/common/installer/poetryInstaller.unit.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ suite('Module Installer - Poetry', () => {
8585

8686
test('Is not supported when there is no resource', async () => {
8787
const supported = await poetryInstaller.isSupported();
88-
assert.equal(supported, false);
88+
assert.strictEqual(supported, false);
8989
});
9090
test('Is not supported when there is no workspace', async () => {
9191
when(workspaceService.getWorkspaceFolder(anything())).thenReturn();
9292

9393
const supported = await poetryInstaller.isSupported(Uri.file(__filename));
9494

95-
assert.equal(supported, false);
95+
assert.strictEqual(supported, false);
9696
});
9797
test('Get Executable info', async () => {
9898
const uri = Uri.file(__dirname);
@@ -134,7 +134,7 @@ suite('Module Installer - Poetry', () => {
134134

135135
const supported = await poetryInstaller.isSupported(Uri.file(__filename));
136136

137-
assert.equal(supported, true);
137+
assert.strictEqual(supported, true);
138138
});
139139

140140
test('Is supported returns true if no interpreter is selected', async () => {
@@ -148,7 +148,7 @@ suite('Module Installer - Poetry', () => {
148148

149149
const supported = await poetryInstaller.isSupported(Uri.file(__filename));
150150

151-
assert.equal(supported, false);
151+
assert.strictEqual(supported, false);
152152
});
153153

154154
test('Is supported returns false if selected interpreter is not related to the workspace', async () => {
@@ -166,7 +166,7 @@ suite('Module Installer - Poetry', () => {
166166

167167
const supported = await poetryInstaller.isSupported(Uri.file(__filename));
168168

169-
assert.equal(supported, false);
169+
assert.strictEqual(supported, false);
170170
});
171171

172172
test('Is supported returns false if selected interpreter is not of Poetry type', async () => {
@@ -184,6 +184,6 @@ suite('Module Installer - Poetry', () => {
184184

185185
const supported = await poetryInstaller.isSupported(Uri.file(__filename));
186186

187-
assert.equal(supported, false);
187+
assert.strictEqual(supported, false);
188188
});
189189
});

0 commit comments

Comments
 (0)