From c2510528f4e864abb6633a387faf5c38b43f41f2 Mon Sep 17 00:00:00 2001 From: Jack Meyer Date: Thu, 11 Jan 2018 11:01:26 -0600 Subject: [PATCH] generate test.js underneath a test directory --- src/services/mocha-service.js | 3 ++- test/mocha-service.test.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/services/mocha-service.js b/src/services/mocha-service.js index 08216db..9d6f86f 100644 --- a/src/services/mocha-service.js +++ b/src/services/mocha-service.js @@ -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 diff --git a/test/mocha-service.test.js b/test/mocha-service.test.js index f936ec1..ea25962 100644 --- a/test/mocha-service.test.js +++ b/test/mocha-service.test.js @@ -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 () => {