Skip to content

Commit

Permalink
check watches
Browse files Browse the repository at this point in the history
  • Loading branch information
ahtrotta committed Aug 23, 2023
1 parent 7663239 commit 2fc19e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
13 changes: 13 additions & 0 deletions test/integration/scanner/performAsAppMapsAreModified.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ import {
waitForAppMapServices,
restoreFile,
withAuthenticatedUser,
executeWorkspaceOSCommand,
} from '../util';

async function getWatches(): Promise<string> {
const watches = await executeWorkspaceOSCommand('ps -ef | grep -e --watch', ProjectA);
return watches;
}

describe('Scanner', () => {
withAuthenticatedUser();

Expand All @@ -41,6 +47,8 @@ describe('Scanner', () => {
// `AppMap index dir should be removed`,
// async () => !existsSync(ExampleAppMapIndexDir)
// );
let watches = await getWatches();
console.log('Wactches: ', watches);

const appMapPath = relative(ProjectA, ExampleAppMap);
await repeatUntil(
Expand All @@ -49,10 +57,15 @@ describe('Scanner', () => {
() => existsSync(join(ExampleAppMapIndexDir, 'appmap-findings.json'))
);

watches = await getWatches();
console.log('Wactches: ', watches);

await repeatUntil(
async () => await restoreFile(appMapPath),
'No Diagnostics were created for Microposts_controller_can_get_microposts_as_JSON',
async () => {
watches = await getWatches();
console.log('Wactches: ', watches);
waitFor(
'diagnostics to be created',
() => getDiagnosticsForAppMap(ExampleAppMap).length > 0,
Expand Down
9 changes: 6 additions & 3 deletions test/integration/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,18 @@ async function closeAllEditors(): Promise<void> {
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
}

export async function executeWorkspaceOSCommand(cmd: string, workspaceName: string): Promise<void> {
return new Promise<void>((resolve, reject) => {
export async function executeWorkspaceOSCommand(
cmd: string,
workspaceName: string
): Promise<string> {
return new Promise<string>((resolve, reject) => {
exec(cmd, { cwd: workspaceName }, (err, stdout, stderr) => {
if (err) {
console.log(stdout);
console.warn(stderr);
return reject(err);
}
resolve();
resolve(stdout);
});
});
}
Expand Down

0 comments on commit 2fc19e1

Please sign in to comment.