Increase v2 test timeout

master
Brad Cornes 2023-08-29 11:04:38 +01:00
parent c1c811e7a3
commit 31e28e862f
1 changed files with 23 additions and 19 deletions

View File

@ -4,32 +4,36 @@ import * as fs from 'node:fs/promises'
withFixture('v2', (c) => { withFixture('v2', (c) => {
function testFixture(fixture) { function testFixture(fixture) {
test(fixture, async () => { test(
fixture = await fs.readFile(`tests/code-actions/${fixture}.json`, 'utf8') fixture,
async () => {
fixture = await fs.readFile(`tests/code-actions/${fixture}.json`, 'utf8')
let { code, expected, language = 'html' } = JSON.parse(fixture) let { code, expected, language = 'html' } = JSON.parse(fixture)
let promise = new Promise((resolve) => { let promise = new Promise((resolve) => {
c.onNotification('textDocument/publishDiagnostics', ({ diagnostics }) => { c.onNotification('textDocument/publishDiagnostics', ({ diagnostics }) => {
resolve(diagnostics) resolve(diagnostics)
})
}) })
})
let textDocument = await c.openDocument({ text: code, lang: language }) let textDocument = await c.openDocument({ text: code, lang: language })
let diagnostics = await promise let diagnostics = await promise
let res = await c.sendRequest('textDocument/codeAction', { let res = await c.sendRequest('textDocument/codeAction', {
textDocument, textDocument,
context: { context: {
diagnostics, diagnostics,
}, },
}) })
// console.log(JSON.stringify(res)) // console.log(JSON.stringify(res))
expected = JSON.parse(JSON.stringify(expected).replaceAll('{{URI}}', textDocument.uri)) expected = JSON.parse(JSON.stringify(expected).replaceAll('{{URI}}', textDocument.uri))
expect(res).toEqual(expected) expect(res).toEqual(expected)
}) },
10000
)
} }
// testFixture('conflict') // testFixture('conflict')