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

Commit 72a42d6

Browse files
richardschneiderdaviddias
authored andcommitted
test(refs): fix symlinks from git (#647)
1 parent 012b86c commit 72a42d6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/refs.spec.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const isNode = require('detect-node')
99
const waterfall = require('async/waterfall')
1010
const path = require('path')
1111
const FactoryClient = require('./ipfs-factory/client')
12+
const fs = require('fs')
1213

1314
describe('.refs', function () {
1415
this.timeout(80 * 1000)
@@ -21,11 +22,21 @@ describe('.refs', function () {
2122

2223
before((done) => {
2324
fc = new FactoryClient()
25+
const filesPath = path.join(__dirname, '/fixtures/test-folder')
26+
27+
// Symlinks in a repo don't always clone well, especially on Windows.
28+
// So if the 'hello-link' is not a symlink, then make it one.
29+
const symlinkPath = filesPath + '/hello-link'
30+
const symlinkTarget = 'files/hello.txt'
31+
if (!fs.lstatSync(symlinkPath).isSymbolicLink()) {
32+
fs.unlinkSync(symlinkPath)
33+
fs.symlinkSync(symlinkTarget, symlinkPath)
34+
}
35+
2436
waterfall([
2537
(cb) => fc.spawnNode(cb),
2638
(node, cb) => {
2739
ipfs = node
28-
const filesPath = path.join(__dirname, '/fixtures/test-folder')
2940
ipfs.util.addFromFs(filesPath, { recursive: true }, cb)
3041
},
3142
(hashes, cb) => {

0 commit comments

Comments
 (0)