mfncooper / mockery

Simplifying the use of mocks with Node.js
Other
1.1k stars 60 forks source link

Mocks not recognized #67

Open Gobliins opened 6 years ago

Gobliins commented 6 years ago

I have this code from:

https://sazzer.github.io/blog/2015/08/20/Unit-Testing-ES6-Modules-Mockery/

I run the test by BABEL_ENV=ES2015 mocha --require babel-register --recursive tests

But i don't get the mocked name in return, instead i get the original name: AssertionError: 'Hello, Fred' == 'Hello, Graham'

I am using Node: 4.8.4 "mockery": "^2.1.0" "mocha": "^4.0.1" "babel-core": "^6.26.0", "babel-plugin-module-resolver": "^2.7.1", "babel-plugin-rewire": "^1.1.0", "babel-plugin-rewire-exports": "^0.2.2", "babel-preset-env": "^1.6.1", "babel-register": "^6.26.0", "babel-template": "^6.26.0", "babel-types": "^6.26.0",

Normally this should work, when i use boogie666s atom mocha test runner it's working. But strangely when using mocha / npm the mock is not recognized... anyone knows why?

brandonburkett commented 6 years ago

Same issue on my end, unsure if it is because of babel-register or not.