Added an option to open the browser when testing locally. (#612)

This commit is contained in:
MarieMalarme 2020-06-18 15:32:04 +01:00 committed by GitHub
parent e763acfb81
commit e9cab0a8cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -8,7 +8,7 @@ const exercise = process.argv[2]
if (!exercise) throw Error(`usage: node test EXERCISE_NAME`)
const PORT = 9898
const config = {
args: [
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
@ -16,6 +16,7 @@ const config = {
// because Dockers default for /dev/shm is 64MB
'--disable-dev-shm-usage',
],
headless: !process.env.SOLUTION_PATH,
}
const solutionPath = process.env.SOLUTION_PATH || '/jail/student'
@ -40,13 +41,13 @@ const server = http
const stream = fs
.createReadStream(filepath)
.pipe(response)
.once('error', (err) => {
.once('error', err => {
console.log(err)
response.statusCode = 500 // handle 404 ?
response.end('oopsie')
})
})
.listen(PORT, async (err) => {
.listen(PORT, async err => {
let browser,
code = 0
try {