Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 4073e23

Browse files
committed
Fix for some failing cli tests - version, etc.
_isInitialized was changes to _checkInitialized and now returns a promise.
1 parent 55c4446 commit 4073e23

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/core/components/repo.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ module.exports = function repo (self) {
1616
* @param {function(Error, Number)} [callback]
1717
* @returns {undefined}
1818
*/
19-
version: promisify((callback) => {
20-
self._repo._isInitialized(err => {
21-
if (err) {
22-
// TODO: (dryajov) This is really hacky, there must be a better way
23-
const match = [
24-
/Key not found in database \[\/version\]/,
25-
/ENOENT/,
26-
/repo is not initialized yet/
27-
].some((m) => {
28-
return m.test(err.message)
29-
})
30-
if (match) {
31-
// this repo has not been initialized
32-
return callback(null, repoVersion)
33-
}
34-
return callback(err)
19+
version: promisify(async (callback) => {
20+
const err = await self._repo._checkInitialized()
21+
22+
if (err) {
23+
// TODO: (dryajov) This is really hacky, there must be a better way
24+
const match = [
25+
/Key not found in database \[\/version\]/,
26+
/ENOENT/,
27+
/repo is not initialized yet/
28+
].some((m) => {
29+
return m.test(err.message)
30+
})
31+
if (match) {
32+
// this repo has not been initialized
33+
return callback(null, repoVersion)
3534
}
35+
return callback(err)
36+
}
3637

37-
self._repo.version.get(callback)
38-
})
38+
self._repo.version.get(callback)
3939
}),
4040

4141
gc: require('./pin/gc')(self),

0 commit comments

Comments
 (0)