Merge pull request #1607 from github/aeisenberg/fix-failing-tests
`loadPersistedState` should happen outside of dbm constructor
This commit is contained in:
@@ -559,9 +559,6 @@ export class DatabaseManager extends DisposableObject {
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
qs.onStart(this.reregisterDatabases.bind(this));
|
qs.onStart(this.reregisterDatabases.bind(this));
|
||||||
|
|
||||||
// Let this run async.
|
|
||||||
void this.loadPersistedState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async openDatabase(
|
public async openDatabase(
|
||||||
@@ -691,7 +688,7 @@ export class DatabaseManager extends DisposableObject {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async loadPersistedState(): Promise<void> {
|
public async loadPersistedState(): Promise<void> {
|
||||||
return withProgress({
|
return withProgress({
|
||||||
location: vscode.ProgressLocation.Notification
|
location: vscode.ProgressLocation.Notification
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -452,6 +452,10 @@ async function activateWithInstalledDistribution(
|
|||||||
|
|
||||||
void logger.log('Initializing database manager.');
|
void logger.log('Initializing database manager.');
|
||||||
const dbm = new DatabaseManager(ctx, qs, cliServer, logger);
|
const dbm = new DatabaseManager(ctx, qs, cliServer, logger);
|
||||||
|
|
||||||
|
// Let this run async.
|
||||||
|
void dbm.loadPersistedState();
|
||||||
|
|
||||||
ctx.subscriptions.push(dbm);
|
ctx.subscriptions.push(dbm);
|
||||||
void logger.log('Initializing database panel.');
|
void logger.log('Initializing database panel.');
|
||||||
const databaseUI = new DatabaseUI(
|
const databaseUI = new DatabaseUI(
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ describe('databases', () => {
|
|||||||
},
|
},
|
||||||
resolveDatabase: resolveDatabaseSpy
|
resolveDatabase: resolveDatabaseSpy
|
||||||
} as unknown as CodeQLCliServer,
|
} as unknown as CodeQLCliServer,
|
||||||
{} as Logger,
|
{
|
||||||
|
log: () => { /**/ }
|
||||||
|
} as unknown as Logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Unfortunately, during a test it is not possible to convert from
|
// Unfortunately, during a test it is not possible to convert from
|
||||||
|
|||||||
@@ -12,3 +12,12 @@ chai.use(sinonChai);
|
|||||||
export function run(): Promise<void> {
|
export function run(): Promise<void> {
|
||||||
return runTestsInDirectory(__dirname);
|
return runTestsInDirectory(__dirname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.addListener('unhandledRejection', (reason) => {
|
||||||
|
if (reason instanceof Error && reason.message === 'Canceled') {
|
||||||
|
console.log('Cancellation requested after the test has ended.');
|
||||||
|
process.exit(0);
|
||||||
|
} else {
|
||||||
|
fail(String(reason));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user