/**
 * Dependencies
 */
var TemplateManifest = require('./fixtures/TemplateManifest');
var FileHeap = require('./fixtures/FileHeap');


before(function (cb) {
	var self = this;
	
	/*
	 * Use an allocator to make it easier to manage files
	 * generated during testing
	 */
	self.heap = new FileHeap();

	/*
	 * Another file allocator made to look like a Sails app
	 * to test behavior with and without `--force`, inside
	 * and outside of a Sails project directory.
	 */
	self.sailsHeap = new FileHeap();
	self.sailsHeap.outputJSON(
		self.sailsHeap.alloc('package.json'),
		{
			dependencies: {
				sails: '~5.0.0'
			}
		},
		cb
	);


	/*
	 * Load template fixtures up front so they're accessible 
	 * throughout the generator tests.
	 */
	// var self = this;
	// TemplateManifest.load(function (err) {
	// 	if (err) return err;
	// 	self.templates = TemplateManifest;
	// 	cb();
	// });
});




after(function (cb) {

	/*
	 * Clean up loose files afterwards
	 */
	this.heap.cleanAll(cb);
	this.sailsHeap.cleanAll(cb);
});
@@ -127,16 +127,90 @@
 Heap');%0A
+var GenerateJSONFileHelper = require('../generators/_helpers/jsonfile');%0A%0A
 %0A%0Abefore
@@ -576,37 +576,46 @@
 );%0A%09
-self.sailsHeap.outputJSON(%0A%09%09
+GenerateJSONFileHelper(%7B%0A%09%09pathToNew: 
 self
@@ -650,16 +650,22 @@
 on'),%0A%09%09
+data: 
 %7B%0A%09%09%09dep
@@ -709,16 +709,23 @@
 %0A%09%09%7D
-,
 %0A%09
-%09cb%0A%09
+%7D, %7B ok: cb %7D
 );%0A%0A

Use jsonfile helper to create package.json fixture.