Comments (5)
I've never used Jasmine so I'll have to look into how it works in order to figure out what is breaking.
Do you have a simple repro case that I can run to test with? I can add that to our new tests to make sure that it's executed when we build.
from mockery.
I believe the issue is not Jasmine, but RequireJS. Here is an example that includes the change I made in mockery.js at the beginning of the file:
https://github.com/cristiingineru/testingWithMocks/blob/master/js/node_modules/mockery/mockery.js
After this small change the mockery.js module loads correctly (it's not throwing). But the original modules are not replaced with mocks during testing. Here is an example:
https://github.com/cristiingineru/testingWithMocks/blob/master/js/specs/cSpec.js
Maybe it's just something wrong with my setup.
from mockery.
Its not working for me with Jasmine, hookedLoader is never called for any require following mockery.enable(). I'm not using RequireJS. I added a console.log to check if hookedLoader was called. I tested just in the REPL and it was working fine.
from mockery.
I am using mockery with jasmine and it is working fine. But I using it with the wrapper posted on #28
from mockery.
when you mock paths you need use exactly the same string that was used to require, it not the path from your tests file.
from mockery.
Related Issues (20)
- ResetCache to certain files
- useCleanCache: true - leaks memory
- Fail on unregistered require HOT 2
- Release version HOT 3
- Unexpected token import HOT 1
- How to just intercept a few require calls. HOT 3
- Use semantic versioning and generate a changelog
- sub-dependencies from allowed modules throw warnings as "non-allowed" HOT 4
- Can't mock custom module HOT 3
- `registerMock` should throw an error if the module being mocked has already been required
- Destructuring Bug or am I doing this wrong? HOT 2
- registerMock() does not work when code is ran with jest? HOT 2
- Mocks not recognized HOT 1
- Help Defining Constructor in Mock Object HOT 1
- How to mock .png of .jpg files
- Current project status HOT 2
- How to Spy On a Mocked Thing? HOT 2
- disallow node_modules or dependencies to be mocked
- CVE-2022-37614/Prototype pollution found in mockery.js HOT 3
- Mock destructuring dependency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockery.