From 0b6e96176c563dc20ac74806e186284df5451f05 Mon Sep 17 00:00:00 2001 From: Richard Schneider Date: Sat, 16 Dec 2017 22:06:11 +1300 Subject: [PATCH] test(refs): fix symlinks from git --- test/refs.spec.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/refs.spec.js b/test/refs.spec.js index 9faedc905..b004db6de 100644 --- a/test/refs.spec.js +++ b/test/refs.spec.js @@ -9,6 +9,7 @@ const isNode = require('detect-node') const waterfall = require('async/waterfall') const path = require('path') const FactoryClient = require('./ipfs-factory/client') +const fs = require('fs') describe('.refs', function () { this.timeout(80 * 1000) @@ -21,11 +22,21 @@ describe('.refs', function () { before((done) => { fc = new FactoryClient() + const filesPath = path.join(__dirname, '/fixtures/test-folder') + + // Symlinks in a repo don't always clone well, especially on Windows. + // So if the 'hello-link' is not a symlink, then make it one. + const symlinkPath = filesPath + '/hello-link' + const symlinkTarget = 'files/hello.txt' + if (!fs.lstatSync(symlinkPath).isSymbolicLink()) { + fs.unlinkSync(symlinkPath) + fs.symlinkSync(symlinkTarget, symlinkPath) + } + waterfall([ (cb) => fc.spawnNode(cb), (node, cb) => { ipfs = node - const filesPath = path.join(__dirname, '/fixtures/test-folder') ipfs.util.addFromFs(filesPath, { recursive: true }, cb) }, (hashes, cb) => {