diff --git a/src/InputHandler.api.ts b/src/InputHandler.api.ts index 06f4cf23ba..ef92f29d8a 100644 --- a/src/InputHandler.api.ts +++ b/src/InputHandler.api.ts @@ -14,9 +14,10 @@ let page: puppeteer.Page; const width = 800; const height = 600; -describe('InputHandler Integration Tests', () => { +describe('InputHandler Integration Tests', function(): void { + this.timeout(10000); + before(async function(): Promise { - this.timeout(10000); browser = await puppeteer.launch({ headless: process.argv.indexOf('--headless') !== -1, slowMo: 80, @@ -36,7 +37,6 @@ describe('InputHandler Integration Tests', () => { describe('Device Status Report (DSR)', () => { it('Status Report - CSI 5 n', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.term.onData(e => window.result = e); @@ -46,7 +46,6 @@ describe('InputHandler Integration Tests', () => { }); it('Report Cursor Position (CPR) - CSI 6 n', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(`window.term.write('\\n\\nfoo')`); assert.deepEqual(await page.evaluate(` @@ -60,7 +59,6 @@ describe('InputHandler Integration Tests', () => { }); it('Report Cursor Position (DECXCPR) - CSI ? 6 n', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(`window.term.write('\\n\\nfoo')`); assert.deepEqual(await page.evaluate(` diff --git a/src/public/Terminal.api.ts b/src/public/Terminal.api.ts index d83252290b..afad2699e3 100644 --- a/src/public/Terminal.api.ts +++ b/src/public/Terminal.api.ts @@ -14,9 +14,10 @@ let page: puppeteer.Page; const width = 800; const height = 600; -describe('API Integration Tests', () => { +describe('API Integration Tests', function(): void { + this.timeout(10000); + before(async function(): Promise { - this.timeout(10000); browser = await puppeteer.launch({ headless: process.argv.indexOf('--headless') !== -1, slowMo: 80, @@ -35,14 +36,12 @@ describe('API Integration Tests', () => { }); it('Default options', async function(): Promise { - this.timeout(10000); await openTerminal(); assert.equal(await page.evaluate(`window.term.cols`), 80); assert.equal(await page.evaluate(`window.term.rows`), 24); }); it('write', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.term.write('foo'); @@ -53,7 +52,6 @@ describe('API Integration Tests', () => { }); it('writeln', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.term.writeln('foo'); @@ -66,7 +64,6 @@ describe('API Integration Tests', () => { }); it('writeUtf8', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` // foo @@ -80,7 +77,6 @@ describe('API Integration Tests', () => { }); it('clear', async function(): Promise { - this.timeout(10000); await openTerminal({ rows: 5 }); await page.evaluate(` window.term.write('test0'); @@ -97,7 +93,6 @@ describe('API Integration Tests', () => { }); it('getOption, setOption', async function(): Promise { - this.timeout(10000); await openTerminal(); assert.equal(await page.evaluate(`window.term.getOption('rendererType')`), 'canvas'); await page.evaluate(`window.term.setOption('rendererType', 'dom')`); @@ -106,7 +101,6 @@ describe('API Integration Tests', () => { describe('renderer', () => { it('foreground', async function(): Promise { - this.timeout(10000); await openTerminal({ rendererType: 'dom' }); await page.evaluate(`window.term.write('\\x1b[30m0\\x1b[31m1\\x1b[32m2\\x1b[33m3\\x1b[34m4\\x1b[35m5\\x1b[36m6\\x1b[37m7')`); assert.deepEqual(await page.evaluate(` @@ -131,7 +125,6 @@ describe('API Integration Tests', () => { }); it('background', async function(): Promise { - this.timeout(10000); await openTerminal({ rendererType: 'dom' }); await page.evaluate(`window.term.write('\\x1b[40m0\\x1b[41m1\\x1b[42m2\\x1b[43m3\\x1b[44m4\\x1b[45m5\\x1b[46m6\\x1b[47m7')`); assert.deepEqual(await page.evaluate(` @@ -157,7 +150,6 @@ describe('API Integration Tests', () => { }); it('selection', async function(): Promise { - this.timeout(10000); await openTerminal({ rows: 5, cols: 5 }); await page.evaluate(`window.term.write('\\n\\nfoo\\n\\n\\rbar\\n\\n\\rbaz')`); assert.equal(await page.evaluate(`window.term.hasSelection()`), false); @@ -178,7 +170,6 @@ describe('API Integration Tests', () => { }); it('focus, blur', async function(): Promise { - this.timeout(10000); await openTerminal(); assert.equal(await page.evaluate(`document.activeElement.className`), ''); await page.evaluate(`window.term.focus()`); @@ -189,7 +180,6 @@ describe('API Integration Tests', () => { describe('loadAddon', () => { it('constructor', async function(): Promise { - this.timeout(10000); await openTerminal({ cols: 5 }); await page.evaluate(` window.cols = 0; @@ -202,7 +192,6 @@ describe('API Integration Tests', () => { }); it('dispose (addon)', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.disposeCalled = false @@ -218,7 +207,6 @@ describe('API Integration Tests', () => { }); it('dispose (terminal)', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.disposeCalled = false @@ -235,7 +223,6 @@ describe('API Integration Tests', () => { describe('Events', () => { it('onCursorMove', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.callCount = 0; @@ -248,7 +235,6 @@ describe('API Integration Tests', () => { }); it('onData', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.calls = []; @@ -259,7 +245,6 @@ describe('API Integration Tests', () => { }); it('onKey', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.calls = []; @@ -270,7 +255,6 @@ describe('API Integration Tests', () => { }); it('onLineFeed', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.callCount = 0; @@ -283,7 +267,6 @@ describe('API Integration Tests', () => { }); it('onScroll', async function(): Promise { - this.timeout(10000); await openTerminal({ rows: 5 }); await page.evaluate(` window.calls = []; @@ -300,7 +283,6 @@ describe('API Integration Tests', () => { }); it('onSelectionChange', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.callCount = 0; @@ -314,7 +296,6 @@ describe('API Integration Tests', () => { }); it('onRender', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.calls = []; @@ -328,7 +309,6 @@ describe('API Integration Tests', () => { }); it('onResize', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.calls = []; @@ -342,7 +322,6 @@ describe('API Integration Tests', () => { }); it('onTitleChange', async function(): Promise { - this.timeout(10000); await openTerminal(); await page.evaluate(` window.calls = []; @@ -356,7 +335,6 @@ describe('API Integration Tests', () => { describe('buffer', () => { it('cursorX, cursorY', async function(): Promise { - this.timeout(10000); await openTerminal({ rows: 5, cols: 5 }); assert.equal(await page.evaluate(`window.term.buffer.cursorX`), 0); assert.equal(await page.evaluate(`window.term.buffer.cursorY`), 0); @@ -378,7 +356,6 @@ describe('API Integration Tests', () => { }); it('viewportY', async function(): Promise { - this.timeout(10000); await openTerminal({ rows: 5 }); assert.equal(await page.evaluate(`window.term.buffer.viewportY`), 0); await page.evaluate(`window.term.write('\\n\\n\\n\\n')`); @@ -394,7 +371,6 @@ describe('API Integration Tests', () => { }); it('baseY', async function(): Promise { - this.timeout(10000); await openTerminal({ rows: 5 }); assert.equal(await page.evaluate(`window.term.buffer.baseY`), 0); await page.evaluate(`window.term.write('\\n\\n\\n\\n')`); @@ -410,7 +386,6 @@ describe('API Integration Tests', () => { }); it('length', async function(): Promise { - this.timeout(10000); await openTerminal({ rows: 5 }); assert.equal(await page.evaluate(`window.term.buffer.length`), 5); await page.evaluate(`window.term.write('\\n\\n\\n\\n')`); @@ -423,14 +398,12 @@ describe('API Integration Tests', () => { describe('getLine', () => { it('invalid index', async function(): Promise { - this.timeout(10000); await openTerminal({ rows: 5 }); assert.equal(await page.evaluate(`window.term.buffer.getLine(-1)`), undefined); assert.equal(await page.evaluate(`window.term.buffer.getLine(5)`), undefined); }); it('isWrapped', async function(): Promise { - this.timeout(10000); await openTerminal({ cols: 5 }); assert.equal(await page.evaluate(`window.term.buffer.getLine(0).isWrapped`), false); assert.equal(await page.evaluate(`window.term.buffer.getLine(1).isWrapped`), false); @@ -443,7 +416,6 @@ describe('API Integration Tests', () => { }); it('translateToString', async function(): Promise { - this.timeout(10000); await openTerminal({ cols: 5 }); assert.equal(await page.evaluate(`window.term.buffer.getLine(0).translateToString()`), ' '); assert.equal(await page.evaluate(`window.term.buffer.getLine(0).translateToString(true)`), ''); @@ -459,7 +431,6 @@ describe('API Integration Tests', () => { }); it('getCell', async function(): Promise { - this.timeout(10000); await openTerminal({ cols: 5 }); assert.equal(await page.evaluate(`window.term.buffer.getLine(0).getCell(-1)`), undefined); assert.equal(await page.evaluate(`window.term.buffer.getLine(0).getCell(5)`), undefined);