Skip to content

Commit

Permalink
Merge pull request #155 from hammer-io/fix-141-generate-test-under-te…
Browse files Browse the repository at this point in the history
…st-directory

generate test.js underneath a test directory
  • Loading branch information
jackcmeyer authored Jan 11, 2018
2 parents 41ccf31 + c251052 commit 3b1356f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/services/mocha-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const log = getActiveLogger();
*/
export async function generateMochaFiles(projectName) {
log.verbose('Mocha Service - generateMochaFiles()');
const path = `${projectName}/test.js`;
fs.mkdirSync(`${projectName}/test`);
const path = `${projectName}/test/test.js`;
const content = file.loadTemplate('./../../templates/mocha/test.js');

// add mocha as a dev dependency to the package.json
Expand Down
4 changes: 2 additions & 2 deletions test/mocha-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe('Mocha Service Test', () => {

await generateMochaFiles('test-mocha');

assert.equal(fs.existsSync('test-mocha/test.js'), true);
assert.equal(eol.auto(fs.readFileSync('test-mocha/test.js', 'utf-8')), eol.auto(expectedMochaContents));
assert.equal(fs.existsSync('test-mocha/test/test.js'), true);
assert.equal(eol.auto(fs.readFileSync('test-mocha/test/test.js', 'utf-8')), eol.auto(expectedMochaContents));
});

it('should add mocha as a dev dependency and update the test script', async () => {
Expand Down

0 comments on commit 3b1356f

Please sign in to comment.