From bb44638d362bf0f0d8cdd579ce59338d342e4414 Mon Sep 17 00:00:00 2001 From: Homa Wong Date: Sat, 4 Jun 2016 18:42:29 -0700 Subject: [PATCH] Fix HOME for windows and add appveyor (#92) --- appveyor.yml | 10 ++++++++++ generators/app/createTemplateCommands.js | 2 +- generators/app/index.js | 1 - test/git.spec.js | 16 +++++++++------- test/template.spec.js | 1 - 5 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..f2285dc --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,10 @@ +environment: + nodejs_version: "4.0" +install: + - ps: Install-Product node $env:nodejs_version + - npm install +test_script: + - node --version + - npm --version + - npm test +build: off diff --git a/generators/app/createTemplateCommands.js b/generators/app/createTemplateCommands.js index 255709b..67c5a6f 100644 --- a/generators/app/createTemplateCommands.js +++ b/generators/app/createTemplateCommands.js @@ -6,7 +6,7 @@ const rc = require('rc'); const extend = require('extend'); const TEMPLATEVERSION = 0; -const globalConfigPath = path.join(process.env.HOME, '.generator-typingsrc'); +const globalConfigPath = path.join(process.env[process.platform === 'win32'? 'USERPROFILE': 'HOME'], '.generator-typingsrc'); module.exports = function createTemplateCommmands(generator) { diff --git a/generators/app/index.js b/generators/app/index.js index 58c28de..6701d33 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -16,7 +16,6 @@ const collectingSourceInfo = []; const TEMPLATEVERSION = 0; const GENERATORVERSION = '1.0'; -const globalConfigPath = path.join(process.env.HOME, '.generator-typingsrc'); module.exports = yeoman.Base.extend({ constructor: function () { diff --git a/test/git.spec.js b/test/git.spec.js index f2a8146..45c3b9e 100644 --- a/test/git.spec.js +++ b/test/git.spec.js @@ -77,22 +77,24 @@ describe(`${GENERATOR_NAME} git tests`, () => { it('when it is a cloned git repo', () => { let generator; return helpers.run(path.join(__dirname, `../generators/${GENERATOR_NAME}`)) - .withOptions({ - skipConfiguring: true, - skipDefault: true, - skipWriting: true, - skipInstall: true, - skipGit: true - }) .inTmpDir((dir) => { let git = simpleGit(dir); return new Promise((resolve) => { git.clone('https://github.com/typings/generator-typings-blank-repo-for-test', '.', () => { + console.log('git clone completed'); resolve(); }); }); }) + .withOptions({ + skipConfiguring: true, + skipDefault: true, + skipWriting: true, + skipInstall: true, + skipGit: true + }) .on('ready', (gen) => { + console.log('helper say ready'); generator = gen; }) .toPromise() diff --git a/test/template.spec.js b/test/template.spec.js index 559a160..dca2f5b 100644 --- a/test/template.spec.js +++ b/test/template.spec.js @@ -36,7 +36,6 @@ describe(`${GENERATOR_NAME} template tests`, () => { }) .toPromise() .then((dir) => { - console.log(generator.configTemplate); assert.objectContent(generator.configTemplate, template); }); });