I'm trying to test my generator, which, using composeWith()
, relies on the sub-generator generator-express.
This is an excerpt from my test with the mock dummy generator:
this.composeWith(require.resolve('generator-express/app'), {dirname: this.props.app_name, createDirectory: 'n'});
var deps = [
[helpers.createDummyGenerator(), require.resolve('generator-express/app')]
];
describe('generator-cesium/app Test', () => {
beforeEach(() => {
return helpers.run(path.join(__dirname, '../generators/app'))
.inDir(path.join(__dirname, 'tmp'))
.withPrompts({
viewerContext: '/', // eslint-disable-line camelcase
appName: 'app' // eslint-disable-line camelcase
})
.withGenerators(deps)
});
...
But, I keep getting the following error:
Error [ERR_UNHANDLED_ERROR]: Unhandled error. (TypeError: Cannot read property 'match' of undefined)
at Immediate.setImmediate (node_modules/generator-express/node_modules/yeoman-generator/lib/index.js:406:18)
The error, indicating that the sub-generator is still being executed, leads me to believe that the mock is not actually working?
from composeWith sub-generator not mocking as expected?
No comments:
Post a Comment