Skip to content

Commit

Permalink
test: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ahtrotta committed Aug 22, 2023
1 parent 9a52c62 commit 1e4d915
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions test/integration/scanner/performAsAppMapsAreModified.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as vscode from 'vscode';
import assert from 'assert';
import { exists, stat } from 'fs';
import { existsSync, statSync } from 'fs';
import { join, relative } from 'path';
import { promisify } from 'util';
import {
initializeWorkspace,
waitFor,
Expand All @@ -26,7 +25,7 @@ describe('Scanner', () => {
'tmp/appmap/minitest/Microposts_controller_can_get_microposts_as_JSON.appmap.json'
);
await waitFor('Index directory exists', async () => {
return Boolean(await promisify(stat)(ExampleAppMapIndexDir));
return Boolean(statSync(ExampleAppMapIndexDir));
});
});

Expand All @@ -37,23 +36,27 @@ describe('Scanner', () => {

await waitFor('Diagnostics were not cleared', hasNoDiagnostics);

// KEG: Remove this, as it's failing due to an issue either with IndexJanitor or with the test itself.
// await waitFor(
// `AppMap index dir should be removed`,
// async () => !(await promisify(exists)(ExampleAppMapIndexDir))
// );
await waitFor(
`AppMap index dir should be removed`,
async () => !existsSync(ExampleAppMapIndexDir)
);

const appMapPath = relative(ProjectA, ExampleAppMap);
await repeatUntil(
async () => await restoreFile(appMapPath),
`AppMap should be reindexed`,
async () => promisify(exists)(join(ExampleAppMapIndexDir, 'mtime'))
() => existsSync(join(ExampleAppMapIndexDir, 'mtime'))
);

await repeatUntil(
async () => await restoreFile(appMapPath),
'No Diagnostics were created for Microposts_controller_can_get_microposts_as_JSON',
async () => {
waitFor(
'diagnostics to be created',
() => getDiagnosticsForAppMap(ExampleAppMap).length > 0,
1000
);
return getDiagnosticsForAppMap(ExampleAppMap).length > 0;
}
);
Expand Down

0 comments on commit 1e4d915

Please sign in to comment.