test timeout fixes

This commit is contained in:
extremeheat 2021-03-25 04:38:46 -04:00
commit be98fc6cf8
5 changed files with 8 additions and 7 deletions

View file

@ -8,8 +8,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:

View file

@ -2,7 +2,7 @@ const { Versions } = require('../src/options')
const { getFiles } = require('../src/datatypes/util')
const { join } = require('path')
const fileMap = {}
let fileMap = {}
// Walks all the directories for each of the supported versions in options.js
// then builds a file map for each version
@ -23,6 +23,8 @@ function loadVersions () {
}
module.exports = (protocolVersion) => {
fileMap = {}
loadVersions()
return {
// Returns the most recent file based on the specified protocolVersion
// e.g. if `version` is 1.16 and a file for 1.16 doesn't exist, load from 1.15 file
@ -40,5 +42,3 @@ module.exports = (protocolVersion) => {
}
}
}
loadVersions()

View file

@ -6,7 +6,7 @@
"scripts": {
"build": "cd tools && node compileProtocol.js",
"prepare": "npm run build",
"test": "mocha",
"test": "mocha --bail",
"pretest": "npm run lint",
"lint": "standard",
"vanillaServer": "node tools/startVanillaServer.js",

View file

@ -191,10 +191,10 @@ async function requestChunks (x, z, radius) {
return chunks
}
async function timedTest (version) {
async function timedTest (version, timeout = 1000 * 120) {
await waitFor((res) => {
startTest(version, res)
}, 1000 * 60, () => {
}, timeout, () => {
throw Error('timed out')
})
console.info('✔ ok')

View file

@ -87,6 +87,7 @@ async function dump (version, force) {
})
}, 1000 * 60, () => {
clearInterval(loop)
handle.kill()
throw Error('timed out')
})
}