Error while opening file under mocha test
See original GitHub issueI have implemented a yauzl.open(path, { lazyEntries: true}, (error, zipfile) => {}); that works fine for normal operation.
The failure happens when I try to do the same inside a mocha test, where the file gives an error when trying to open the zip file as shown here:
Error: end of central directory record signature not found
at /myproject/node_modules/yauzl/index.js:187:14
at /myproject/node_modules/yauzl/index.js:631:5
at /myproject/node_modules/fd-slicer/index.js:32:7
at FSReqWrap.wrapper [as oncomplete] (fs.js:658:17)
After running the test, the zip file is corrupted and if you try to extract it, you get a .zip.cpgz (Im using MacOS Mojave)
Note that is the same file that works when running from the main code. The mocha test use a tdd style. For context, Im using the VScode extension test test runner since I am working on a extension.
If there is anything I can add please let me know.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Mocha Test Exception occurred while loading your tests
I'm experiencing a problem with testing my Vue.js project. We have mocha-webpack to compile and run the test files.
Read more >Error when loading tests · Issue #7 · hbenl/vscode-mocha-test ...
I got another error when load tests.: [2018-08-01 13:50:56.037] [INFO] Loading test files of c:\Users\Daniel\Desktop\SoluCX\baseimporter ...
Read more >Getting Started with Node.js and Mocha - Semaphore Tutorial
Mocha is a simple, extensible and fast testing library for Node.js. This article will walk you through its installation, configuration and usage.
Read more >Testing with Mocha and local files - CloudAppie
When writing the test cases there are a few scenario's you want to test, things like success and failure when working with the...
Read more >Running Tests and Interpreting Output with Mocha and Chai
To run tests for your projects, first open the root project directory in your terminal. ... mocha will log that error in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue had nothing to do with yauzl, another test was breaking the file. Sorry for the inconvenience.
Yes, sorry I was not clear. So
'end'
event I am referring to is the one from zip file. Will update on first post. In the write streamclose
event Im doing the same as Cpp tools extension here : https://github.com/Microsoft/vscode-cpptools/blob/master/Extension/src/packageManager.ts#L376