Fix test conflict and missing mock
This commit is contained in:
Родитель
d16ed78248
Коммит
f136fd495c
|
@ -68,6 +68,15 @@ suite('ChromeDebugAdapter', () => {
|
|||
});
|
||||
|
||||
suite('launch()', () => {
|
||||
let originalSpawn: any;
|
||||
let originalStatSync: any;
|
||||
|
||||
teardown(() => {
|
||||
// Hacky mock cleanup
|
||||
require('child_process').spawn = originalSpawn;
|
||||
require('fs').statSync = originalStatSync;
|
||||
})
|
||||
|
||||
test('launches with minimal correct args', () => {
|
||||
let spawnCalled = false;
|
||||
function spawn(chromePath: string, args: string[]): any {
|
||||
|
@ -84,7 +93,9 @@ suite('ChromeDebugAdapter', () => {
|
|||
|
||||
// Mock spawn for chrome process, and 'fs' for finding chrome.exe.
|
||||
// These are mocked as empty above - note that it's too late for mockery here.
|
||||
originalSpawn = require('child_process').spawn;
|
||||
require('child_process').spawn = spawn;
|
||||
originalStatSync = require('fs').statSync;
|
||||
require('fs').statSync = () => true;
|
||||
|
||||
mockChromeConnection
|
||||
|
|
|
@ -50,7 +50,8 @@ function getRuntimeStubs(mockEventEmitter) {
|
|||
evaluate() { },
|
||||
|
||||
onConsoleAPICalled(handler) { mockEventEmitter.on('Runtime.consoleAPICalled', handler); },
|
||||
onExecutionContextsCleared(handler) { mockEventEmitter.on('Runtime.executionContextsCleared', handler); }
|
||||
onExecutionContextsCleared(handler) { mockEventEmitter.on('Runtime.executionContextsCleared', handler); },
|
||||
onExceptionThrown(handler) { mockEventEmitter.on('Runtime.onExceptionThrown', handler); }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче