For express it is described in
how to properly close node-express server?
but in documentation of yoga
https://github.com/prisma/graphql-yoga
there is not info about close
method.
UPDATE
Solution of @perdox solves my problem, correct answer is:
const gqlServer = new GraphQLServer({ typeDefs, resolvers });
const server = gqlServer.start(() => console.log('Server is running on localhost:4000'));
(async function f() {
(await server).close();
})();