Skip to content

Commit f945df1

Browse files
authored
Enable strict mode and bump target for test/smoke (microsoft#165296)
1 parent c55ef92 commit f945df1

File tree

3 files changed

+8
-27
lines changed

3 files changed

+8
-27
lines changed

test/smoke/src/areas/workbench/data-loss.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
7171
});
7272

7373
it('verifies that "hot exit" works for dirty files (without delay)', function () {
74-
return testHotExit.call(this, 'test_verifies_that_hot_exit_works_for_dirty_files_without_delay', undefined);
74+
return testHotExit.call(this, 'test_verifies_that_hot_exit_works_for_dirty_files_without_delay', undefined, undefined);
7575
});
7676

7777
it('verifies that "hot exit" works for dirty files (with delay)', function () {
78-
return testHotExit.call(this, 'test_verifies_that_hot_exit_works_for_dirty_files_with_delay', 2000);
78+
return testHotExit.call(this, 'test_verifies_that_hot_exit_works_for_dirty_files_with_delay', 2000, undefined);
7979
});
8080

8181
it('verifies that auto save triggers on shutdown', function () {
8282
return testHotExit.call(this, 'test_verifies_that_auto_save_triggers_on_shutdown', undefined, true);
8383
});
8484

85-
async function testHotExit(title: string, restartDelay: number | undefined, autoSave: boolean | undefined) {
85+
async function testHotExit(this: import('mocha').Context, title: string, restartDelay: number | undefined, autoSave: boolean | undefined) {
8686
app = createApp({
8787
...this.defaultOptions,
8888
logsPath: suiteLogsPath(this.defaultOptions, title),
@@ -201,7 +201,7 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
201201
return testHotExit.call(this, `test_verifies_that_hot_exit_works_for_dirty_files_with_delay_from_stable`, 2000);
202202
});
203203

204-
async function testHotExit(title: string, restartDelay: number | undefined) {
204+
async function testHotExit(this: import('mocha').Context, title: string, restartDelay: number | undefined) {
205205
const stableCodePath = ensureStableCode();
206206
if (!stableCodePath) {
207207
this.skip();

test/smoke/src/utils.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,6 @@ export function itRepeat(n: number, description: string, callback: (this: Contex
1919
}
2020
}
2121

22-
/**
23-
* Defines a test-case that will run but will be skips it if it throws an exception. This is useful
24-
* to get some runs in CI when trying to stabilize a flaky test, without failing the build. Note
25-
* that this only works if something inside the test throws, so a test's overall timeout won't work
26-
* but throwing due to a polling timeout will.
27-
* @param title The test-case title.
28-
* @param callback The test-case callback.
29-
*/
30-
export function itSkipOnFail(title: string, callback: (this: Context) => any): void {
31-
it(title, function () {
32-
return Promise.resolve().then(() => {
33-
return callback.apply(this, arguments);
34-
}).catch(e => {
35-
console.warn(`Test "${title}" failed but was marked as skip on fail:`, e);
36-
this.skip();
37-
});
38-
});
39-
}
40-
4122
export function installAllHandlers(logger: Logger, optionsTransform?: (opts: ApplicationOptions) => ApplicationOptions) {
4223
installDiagnosticsHandler(logger);
4324
installAppBeforeHandler(optionsTransform);
@@ -195,7 +176,7 @@ export async function retry<T>(task: ITask<Promise<T>>, delay: number, retries:
195176

196177
return await task();
197178
} catch (error) {
198-
lastError = error;
179+
lastError = error as Error;
199180

200181
await timeout(delay);
201182
}

test/smoke/tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"noImplicitAny": false,
55
"removeComments": false,
66
"preserveConstEnums": true,
7-
"target": "es2017",
8-
"strictNullChecks": true,
7+
"target": "es2020",
8+
"strict": true,
99
"noUnusedParameters": false,
1010
"noUnusedLocals": true,
1111
"outDir": "out",
1212
"sourceMap": true,
1313
"lib": [
14-
"es2016",
14+
"es2020",
1515
"dom"
1616
]
1717
},

0 commit comments

Comments
 (0)