howto unit test a yeoman generator -


i had @ official guide @ http://yeoman.io/authoring/testing.html left me bit confused. helpers.run returns running context on can call methods etc. i'm confused how can test if file exists (with assert.file ) under impression helpers.run wil create files either in memory or on file system. assert.file fails. won't fail files present on filesystem prior running test.

when run generator (yo my-generator) see files created.

how can test if files haven been created? here's code far doesn't work.

i'm using jasmine testing.

let helpers = require('yeoman-test'); let assert = require('yeoman-assert');  describe('generator:test', function () {      let path = require('path');      beforeeach(function () {         console.log(path.join(__dirname, '../generators/app'));         // object returned acts promise, return wait until process done         helpers.run(path.join(__dirname, '../generators/app'))             .withprompts({                 name: 'test',                 appname: 'test',                 apptitle: 'test',                 apiendpoint: 'http://localhost'             });     })      it('all config files', function () {          assert.file(#arrayoffiles#);     }); }); 


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -