Skip to content

Commit 532fb66

Browse files
authored
Merge pull request #91 from Automattic/strict-assertions
test: use strict assertions
2 parents 1b42a8d + 47b0154 commit 532fb66

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/test/suite/stopwatchingcommand.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { equal, notEqual } from 'node:assert';
1+
import { equal, notEqual } from 'node:assert/strict';
22
import { commands } from 'vscode';
33
import { waitForOutputWindow } from './utils';
4-
import { getFilenames } from '../../resources';
4+
import { freeAllResources, getFilenames } from '../../resources';
55

66
suite('StopWatchingCommand', function () {
7+
this.afterEach(function () {
8+
freeAllResources();
9+
});
10+
711
test('cancel effect of watchFileCommand', async function () {
812
const filename = __filename;
913

src/test/suite/watchfilecommand.test.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { deepEqual, equal, match, notEqual } from 'node:assert';
1+
import { deepEqual, equal, match, notEqual } from 'node:assert/strict';
22
import { EventEmitter, once } from 'node:events';
33
import { WriteStream, createWriteStream } from 'node:fs';
44
import { mkdtemp, rm, unlink, writeFile } from 'node:fs/promises';
@@ -44,7 +44,7 @@ suite('WatchFileCommand', function () {
4444

4545
this.timeout('win32' === platform() ? 20000 : 2000);
4646

47-
test('watchFileCommandHandler - smoke test', async function () {
47+
test('smoke test', async function () {
4848
const filename = __filename;
4949

5050
const [editor] = await Promise.all([
@@ -56,7 +56,7 @@ suite('WatchFileCommand', function () {
5656
match(editor?.document.fileName ?? '', new RegExp(`Watch ${filename.replace(/\\/gu, '\\\\')}$`, 'u'));
5757
});
5858

59-
test('watchFileCommandHandler - react to file creation', async function () {
59+
test('react to file creation', async function () {
6060
const fname = join(tmpDir, '0001.txt');
6161

6262
const [editor, emitter] = await Promise.all([
@@ -71,7 +71,7 @@ suite('WatchFileCommand', function () {
7171
await Promise.all([once(emitter, 'fileCreated'), writeFile(fname, '')]);
7272
});
7373

74-
test('watchFileCommandHandler - react to file modification', async function () {
74+
test('react to file modification', async function () {
7575
const fname = join(tmpDir, '0002.txt');
7676

7777
const stream = createWriteStream(fname);
@@ -96,7 +96,7 @@ suite('WatchFileCommand', function () {
9696
equal(actual, expectedContent);
9797
});
9898

99-
test('watchFileCommandHandler - react to file removal', async function () {
99+
test('react to file removal', async function () {
100100
const fname = join(tmpDir, '0003.txt');
101101

102102
await writeFile(fname, '');
@@ -117,7 +117,7 @@ suite('WatchFileCommand', function () {
117117
equal(actual, expected);
118118
});
119119

120-
test('watchFileCommandHandler - preload last 10 lines', async function () {
120+
test('preload last 10 lines', async function () {
121121
const fname = join(tmpDir, '0004.txt');
122122

123123
const expectedContent = '1\n2\n3\n4\n5\n6\n7\n8\n9\nA\n';
@@ -139,8 +139,7 @@ suite('WatchFileCommand', function () {
139139
equal(actual, expectedContent);
140140
});
141141

142-
test('watchFileCommandHandler - preload entire file if less than 10 lines', async function () {
143-
tmpDir = await mkdtemp(join(tmpdir(), 'logwatcher-test-'));
142+
test('preload entire file if less than 10 lines', async function () {
144143
const fname = join(tmpDir, '0005.txt');
145144

146145
const expectedContent = '1\n2\n3\n';
@@ -162,7 +161,7 @@ suite('WatchFileCommand', function () {
162161
equal(actual, expectedContent);
163162
});
164163

165-
test('watchFileCommandHandler - reuse existing output channel', async function () {
164+
test('reuse existing output channel', async function () {
166165
const filename = __filename;
167166

168167
await commands.executeCommand('logwatcher.watchFile', filename);

0 commit comments

Comments
 (0)