Skip to content

Commit

Permalink
Replace pFinally with native code
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie committed Jul 23, 2020
1 parent de0c144 commit 01eab32
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-buttons-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystonejs/test-utils': patch
---

Replaced use of "p-finally" library with native Node code.
13 changes: 7 additions & 6 deletions packages/test-utils/lib/test-utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const express = require('express');
const supertest = require('supertest-light');
const MongoDBMemoryServer = require('mongodb-memory-server-core').default;
const pFinally = require('p-finally');
const url = require('url');
const { Keystone } = require('@keystonejs/keystone');
const { GraphQLApp } = require('@keystonejs/app-graphql');
Expand Down Expand Up @@ -185,17 +184,19 @@ function _keystoneRunner(adapterName, tearDownFunction) {

await keystone.connect();

return pFinally(
testFn({
try {
await testFn({
...setup,
create: getCreate(keystone),
findById: getFindById(keystone),
findOne: getFindOne(keystone),
update: getUpdate(keystone),
delete: getDelete(keystone),
}),
() => keystone.disconnect().then(tearDownFunction)
);
});
} finally {
await keystone.disconnect();
await tearDownFunction();
}
};
};
}
Expand Down
1 change: 0 additions & 1 deletion packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@keystonejs/keystone": "^12.0.0",
"express": "^4.17.1",
"mongodb-memory-server-core": "^6.5.2",
"p-finally": "^2.0.1",
"supertest-light": "^1.0.3"
},
"repository": "https://github.com/keystonejs/keystone/tree/master/packages/test-utils"
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17894,7 +17894,7 @@ p-finally@^1.0.0:
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=

p-finally@^2.0.0, p-finally@^2.0.1:
p-finally@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561"
integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==
Expand Down

0 comments on commit 01eab32

Please sign in to comment.