Skip to content
This repository was archived by the owner on Apr 16, 2020. It is now read-only.

Commit d8542a8

Browse files
richardschneiderdaviddias
authored andcommitted
test: use os.tmpdir() (#12)
* test: use os.tmpdir() * fix: use hat() for unique names
1 parent 168b433 commit d8542a8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"0x": "^2.4.2",
4040
"async": "^2.1.5",
4141
"benchmark-async": "^2.2.0",
42+
"hat": "0.0.3",
4243
"ipfs": "^0.22.1",
4344
"ipfsd-ctl": "^0.20.0",
4445
"opn": "^4.0.2",

src/prepare/js-core/create-repo.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
const IPFSRepo = require('ipfs-repo')
44
const Store = require('fs-pull-blob-store')
55
const clean = require('./destroy-repo')
6+
const os = require('os')
7+
const path = require('path')
8+
const hat = require('hat')
69

710
module.exports = function createTempRepo (repoPath) {
8-
repoPath = repoPath || '/tmp/ipfs-test-' + Math.random().toString().substring(2, 8)
11+
repoPath = repoPath || path.join(os.tmpdir(), 'ipfs-test-' + hat())
912

1013
const repo = new IPFSRepo(repoPath, {
1114
bits: 1024,

0 commit comments

Comments
 (0)