-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.ts
More file actions
25 lines (20 loc) · 710 Bytes
/
server.ts
File metadata and controls
25 lines (20 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import express from 'express';
import { exec } from 'child_process';
import path from 'path';
const app = express();
const port = 3000;
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.get('/', (req, res) => {
exec('npm run test:integration -- --json --outputFile=results.json', (error, stdout, stderr) => {
if (error) {
console.error(`Error executing tests: ${error}`);
return res.status(500).send('Error executing tests');
}
const results = require('./results.json');
res.render('index', { results });
});
});
app.listen(port, () => {
console.log(`Server is running at http://localhost:${port}`);
});