You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting Uncaught Error: ENOENT: no such file or directory, open 'C:\Temp\mockFs\fake\base\path\file.png' when trying to mock out uploading files with needle.
System: Windows 7 x64
node.js: 10.8.0
npm: 6.3.0
needle takes file paths and uploads them onto server via HTTP POST. I am setting a file-system mock before using needle.
// poster-test.tsimport{expect,use}from"chai";importchaiAsPromisedfrom"chai-as-promised";importmockFsfrom"mock-fs";importnockfrom"nock";import{Poster}from"./poster";constposter=newPoster();describe("Poster can...",()=>{beforeEach("Setup Node.http.request stub and mockFs",()=>{use(chaiAsPromised);mockFs({fake: {base: {path: {"file.png": "","file.txt": "This is a textual file"}}}});});afterEach("Restore after mockFs",()=>{mockFs.restore();});it("Succedes to post",async()=>{nock("http://localhost:8080").post(/^\/api.+/gi).reply(200,(requestBody: string)=>console.info(requestBody));awaitposter.post("fake/base/path/file.png","fake/base/path/file.txt");});});
The test is run with mocha, with extensions by chai.
The text was updated successfully, but these errors were encountered:
I am getting
Uncaught Error: ENOENT: no such file or directory, open 'C:\Temp\mockFs\fake\base\path\file.png'
when trying to mock out uploading files with needle.System:
Windows 7 x64
node.js:
10.8.0
npm:
6.3.0
needle
takes file paths and uploads them onto server via HTTP POST. I am setting a file-system mock before usingneedle
.The file that uses
needle
:And here is the test suite:
The test is run with
mocha
, with extensions bychai
.The text was updated successfully, but these errors were encountered: