Skip to content

Commit

Permalink
test log
Browse files Browse the repository at this point in the history
  • Loading branch information
wtto00 committed May 10, 2024
1 parent e3702ba commit 2d47131
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion spec/afterStart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const android = new Android({ debug: true });

let emulatorId = '';
beforeAll(async () => {
console.log('start', new Date().toUTCString());
const avds = await android.listAVDs();
let avdName = '';
if (avds.length === 0) {
Expand All @@ -13,7 +14,6 @@ beforeAll(async () => {
} else {
avdName = avds[0].Name;
}
console.log('start', new Date().toUTCString());
const res = await android.start({
avd: avdName,
noaudio: true,
Expand All @@ -29,6 +29,7 @@ beforeAll(async () => {
} else {
throw Error('no emulator');
}
console.log('start-end', new Date().toUTCString());
}, 1200000);

afterAll(async () => {
Expand Down
3 changes: 2 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function spawnWaitFor(command: string, regex: RegExp, timeout = 600000) {
const { cmd, args } = transformCommand(command);
const proc = spawn(cmd, args, { stdio: ['ignore', 'pipe', 'ignore'] });
const clock = setTimeout(() => {
console.log('clock timeout');
proc.kill();
reject(Error('Execution timeout'));
}, timeout);
Expand All @@ -84,6 +85,7 @@ export function spawnWaitFor(command: string, regex: RegExp, timeout = 600000) {
proc.stdout.on('data', (data: string) => {
output += data;
const matches = data.match(regex);
console.log('matches', matches, data);
if (matches) {
clearTimeout(clock);
resolve({
Expand All @@ -95,7 +97,6 @@ export function spawnWaitFor(command: string, regex: RegExp, timeout = 600000) {
});
proc.on('close', (code, signal) => {
console.log('code,signal', code, signal);
console.log('output', output);

clearTimeout(clock);
reject(Error(output));
Expand Down

0 comments on commit 2d47131

Please sign in to comment.