updating unit test mock, returning promises in integration test teardowns, not waiting to asynchronously kill chrome on windows

This commit is contained in:
Shennie Yao 2019-01-23 16:46:40 -08:00
Родитель 6703f2b7d4
Коммит f3acc91a56
7 изменённых файлов: 12 добавлений и 10 удалений

1
.vscode/launch.json поставляемый
Просмотреть файл

@ -39,6 +39,7 @@
"--reporter", "node_modules/vscode-chrome-debug-core-testsupport/out/loggingReporter.js", "--reporter", "node_modules/vscode-chrome-debug-core-testsupport/out/loggingReporter.js",
"${workspaceFolder}/out/test/int/*.test.js" "${workspaceFolder}/out/test/int/*.test.js"
], ],
"skipFiles": ["<node_internals>/**"],
"outFiles": [ "outFiles": [
"${workspaceFolder}/out/**/*.js" "${workspaceFolder}/out/**/*.js"
] ]

Просмотреть файл

@ -354,7 +354,7 @@ export class ChromeDebugAdapter extends CoreDebugAdapter {
// Only kill Chrome if the 'disconnect' originated from vscode. If we previously terminated // Only kill Chrome if the 'disconnect' originated from vscode. If we previously terminated
// due to Chrome shutting down, or devtools taking over, don't kill Chrome. // due to Chrome shutting down, or devtools taking over, don't kill Chrome.
if (coreUtils.getPlatform() === coreUtils.Platform.Windows && this._chromePID) { if (coreUtils.getPlatform() === coreUtils.Platform.Windows && this._chromePID) {
await this.killChromeOnWindows(this._chromePID); this.killChromeOnWindows(this._chromePID);
} else if (this._chromeProc) { } else if (this._chromeProc) {
logger.log('Killing Chrome process'); logger.log('Killing Chrome process');
this._chromeProc.kill('SIGINT'); this._chromeProc.kill('SIGINT');

Просмотреть файл

@ -103,6 +103,10 @@ suite('ChromeDebugAdapter', () => {
mockChrome.Runtime mockChrome.Runtime
.setup(x => x.evaluate(It.isAny())) .setup(x => x.evaluate(It.isAny()))
.returns(() => Promise.resolve<any>({ result: { type: 'string', value: '123' }})); .returns(() => Promise.resolve<any>({ result: { type: 'string', value: '123' }}));
mockChrome.Network
.setup(x => x.setCacheDisabled(It.isAny()))
.returns(() => Promise.resolve());
}); });
teardown(() => { teardown(() => {

Просмотреть файл

@ -21,7 +21,7 @@ suite('Chrome Debug Adapter etc', () => {
}); });
teardown(() => { teardown(() => {
testSetup.teardown(); return testSetup.teardown();
}); });
suite('basic', () => { suite('basic', () => {

Просмотреть файл

@ -25,10 +25,7 @@ function runCommonTests(breakOnLoadStrategy: string) {
server.close(); server.close();
} }
return new Promise((resolve, reject) => { return testSetup.teardown();
testSetup.teardown();
resolve();
});
}); });
// this function is to help when launching and setting a breakpoint // this function is to help when launching and setting a breakpoint
@ -253,7 +250,7 @@ suite('BreakOnLoad', () => {
server.close(); server.close();
} }
testSetup.teardown(); return testSetup.teardown();
}); });
test('Hits a single breakpoint in a file on load', async () => { test('Hits a single breakpoint in a file on load', async () => {
@ -320,7 +317,7 @@ suite('BreakOnLoad', () => {
server.close(); server.close();
} }
testSetup.teardown(); return testSetup.teardown();
}); });
test('Does not hit a breakpoint in a file on load', async () => { test('Does not hit a breakpoint in a file on load', async () => {

Просмотреть файл

@ -25,7 +25,7 @@ suite('Breakpoints', () => {
server.close(); server.close();
} }
testSetup.teardown(); return testSetup.teardown();
}); });
suite('Column BPs', () => { suite('Column BPs', () => {

Просмотреть файл

@ -25,7 +25,7 @@ suite('Stepping', () => {
server.close(); server.close();
} }
testSetup.teardown(); return testSetup.teardown();
}); });
suite('skipFiles', () => { suite('skipFiles', () => {