axios-axios/bin/run-karma-tests.js
Jay ef3711d1b3
feat: implement prettier and fix all issues (#7385)
* feat: implement prettier and fix all issues

* fix: failing tests

* fix: implement feedback from codel, ai etc

* chore: dont throw in trim function

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* fix: incorrect fix

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-02-14 16:59:48 +02:00

38 lines
900 B
JavaScript

import { startTestServer, stopHTTPServer } from '../test/helpers/server.js';
import { spawn } from 'child_process';
import chalk from 'chalk';
let server;
async function run() {
console.log(chalk.red.bold(`[ Starting HTTP server... ]`));
server = await startTestServer(3000);
await new Promise((resolve, reject) => {
console.log('Starting karma runner...');
const karma = spawn('npx', ['karma', 'start', 'karma.conf.cjs', '--single-run'], {
stdio: 'inherit',
shell: true,
env: { ...process.env, LISTEN_ADDR: '0.0.0.0' },
});
karma.on('exit', (code) => {
code ? reject(new Error(`Karma tests failed with exit code ${code}`)) : resolve();
});
});
}
(async () => {
try {
await run();
} finally {
if (server) {
console.log(chalk.red.bold(`[ Terminating HTTP server... ]`));
await stopHTTPServer(server);
}
}
})();