Skip to content

Commit

Permalink
test: server.close uses callbacks, not promises
Browse files Browse the repository at this point in the history
  • Loading branch information
Jahed Ahmed committed Aug 19, 2021
1 parent 20feb67 commit 1522c5f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/jest/acceptance/oauth-token.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ describe('test using OAuth token', () => {
server.listen(apiPort, () => done());
});

afterAll(async () => {
await server.close();
afterAll((done) => {
server.close(() => done());
});

it('successfully tests a project with an OAuth env variable set', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/jest/system/lib/commands/fix/fix.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ describe('snyk fix (system tests)', () => {
});
});

afterAll(async () => {
await server.close();
afterAll((done) => {
server.close(() => done());
});

it(
Expand Down
4 changes: 3 additions & 1 deletion test/system/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ after('teardown', async (t) => {
delete process.env.SNYK_PORT;
t.notOk(process.env.SNYK_PORT, 'fake env values cleared');

await server.close();
await new Promise<void>((resolve) => {
server.close(resolve);
});
t.pass('server shutdown');
let key = 'set';
let value = 'api=' + oldKey;
Expand Down
4 changes: 3 additions & 1 deletion test/system/remote-package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ after('teardown', async (t) => {
delete process.env.SNYK_PORT;
t.notOk(process.env.SNYK_PORT, 'fake env values cleared');

await server.close();
await new Promise<void>((resolve) => {
server.close(resolve);
});
t.pass('server shutdown');
let key = 'set';
let value = 'api=' + oldkey;
Expand Down

0 comments on commit 1522c5f

Please sign in to comment.