Comparing version 3.0.1 to 3.0.2
@@ -52,2 +52,3 @@ "use strict"; | ||
} | ||
let fullPath = relativePath; | ||
// at is a spcfical property exist in FSMerge which takes number as input do not perform path operation on it. | ||
@@ -60,3 +61,2 @@ if (propertyName == 'at' || !path.isAbsolute(relativePath)) { | ||
let { _dirList } = this; | ||
let fullPath = relativePath; | ||
for (let i = _dirList.length - 1; i > -1; i--) { | ||
@@ -69,7 +69,4 @@ let { root } = this.PREFIXINDEXMAP[i]; | ||
} | ||
return target[propertyName](fullPath, ...fsArguments); | ||
} | ||
else { | ||
throw new Error(`Relative path is expected, path ${relativePath} is an absolute path. inputPath gets prefixed to the reltivePath provided.`); | ||
} | ||
return target[propertyName](fullPath, ...fsArguments); | ||
} | ||
@@ -76,0 +73,0 @@ class FSMerger { |
{ | ||
"name": "fs-merger", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Reads files from a real location", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -70,2 +70,3 @@ "use strict"; | ||
} | ||
let fullPath = relativePath | ||
@@ -79,3 +80,2 @@ // at is a spcfical property exist in FSMerge which takes number as input do not perform path operation on it. | ||
let { _dirList } = this; | ||
let fullPath = relativePath; | ||
for (let i=_dirList.length-1; i > -1; i--) { | ||
@@ -88,6 +88,4 @@ let { root } = this.PREFIXINDEXMAP[i]; | ||
} | ||
return target[propertyName](fullPath, ...fsArguments); | ||
} else { | ||
throw new Error(`Relative path is expected, path ${relativePath} is an absolute path. inputPath gets prefixed to the reltivePath provided.`); | ||
} | ||
return target[propertyName](fullPath, ...fsArguments); | ||
} | ||
@@ -94,0 +92,0 @@ |
@@ -232,7 +232,14 @@ "use strict"; | ||
it('absolute path throws error', function() { | ||
it('absolute path is accepted', function() { | ||
let filepath = `${__dirname}/../fixtures/test-1`; | ||
expect( ()=>{fsMerger.fs.existsSync(filepath)}).to.throw(`Relative path is expected, path ${filepath} is an absolute path. inputPath gets prefixed to the reltivePath provided.`); | ||
expect(fsMerger.fs.existsSync(filepath)).to.be.true; | ||
}); | ||
it('absolute path is accepted only with allowed operations', function() { | ||
let filepath = `${__dirname}/../fixtures/test-1`; | ||
expect(()=>{ | ||
fsMerger.fs.rmdirSync(filepath); | ||
}).to.throw(`Operation rmdirSync is not allowed with FSMerger.fs. Allowed operations are readFileSync,existsSync,lstatSync,statSync,readdirSync,readdir,readFileMeta,entries,at`); | ||
}); | ||
it('writeFileSync operation must throw error', function () { | ||
@@ -239,0 +246,0 @@ let fsMerger = new FSMerge(['fixtures/test-1']); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
906
49603