Skip to content

Commit

Permalink
Merge pull request #2178 from snyk/test/server-close
Browse files Browse the repository at this point in the history
test: server.close uses callbacks, not promises
  • Loading branch information
Jahed Ahmed authored Aug 20, 2021
2 parents 55e88f9 + 1522c5f commit e7c314f
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 @@ -22,8 +22,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 e7c314f

Please sign in to comment.