diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..bf2ad4cec --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,103 @@ +trigger: +- master + +jobs: +- job: Windows + timeoutInMinutes: 15 + strategy: + matrix: + # Node6: + # nodejs_version: "6" + Node8: + nodejs_version: "8" + maxParallel: 2 + + pool: + vmImage: vs2017-win2016 + + steps: + - task: NodeTool@0 + inputs: + versionSpec: $(nodejs_version) + + - powershell: | + npm config set spin false + npm install + displayName: Install + + - script: | + node --version + call npm --version + call npm run test:bin -- --reporter=xunit --reporter-options output=results-bin.xml + call npm run test:command -- --reporter=xunit --reporter-options output=results-command.xml + displayName: Test + continueOnError: true + enabled: false + + - script: | + call npm run test:acceptance -- --reporter=xunit --reporter-options output=results-acceptance.xml + displayName: Test:acceptance + continueOnError: true + + - script: | + more C:\npm\cache\_logs\*.log + displayName: Show npm logs + continueOnError: true + + - script: | + call npm run test:integration -- --reporter=xunit --reporter-options output=results-integration.xml + displayName: Test:integration + continueOnError: true + enabled: false + + - script: | + call npm run test:unit -- --reporter=xunit --reporter-options output=results-unit.xml + displayName: Test:unit + continueOnError: true + enabled: false + + - task: PublishTestResults@2 + displayName: Publish Tests Results + inputs: + testResultsFiles: 'results-*.xml' + testResultsFormat: XUnit + searchFolder: '$(Build.SourcesDirectory)' + condition: succeededOrFailed() + +# - job: Linux +# strategy: +# matrix: +# Node6: +# nodejs_version: "6" +# Node8: +# nodejs_version: "8" +# maxParallel: 2 + +# pool: +# vmImage: ubuntu-16.04 + +# steps: +# - task: NodeTool@0 +# inputs: +# versionSpec: $(nodejs_version) + +# - bash: | +# npm config set spin false +# npm install +# displayName: Install + +# - script: | +# node --version +# npm --version +# npm run test:bin -- --reporter=xunit --reporter-options output=results-bin.xml +# npm run test:command -- --reporter=xunit --reporter-options output=results-command.xml +# displayName: Test +# continueOnError: true + +# - task: PublishTestResults@2 +# displayName: Publish Tests Results +# inputs: +# testResultsFiles: 'results-*.xml' +# testResultsFormat: XUnit +# searchFolder: '$(Build.SourcesDirectory)' +# condition: succeededOrFailed() diff --git a/package.json b/package.json index 9930c8072..a1ea2a56e 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ "ember-cli-update": "bin/ember-cli-update.js" }, "scripts": { + "test:acceptance": "cross-env DEBUG=ember-cli-update,git-diff-apply,git-fixtures mocha --bail --inspect --exit \"test/acceptance/**/!(ember-addon)-test.js\"", + "test:integration": "cross-env DEBUG=ember-cli-update,git-diff-apply,git-fixtures mocha \"test/integration/**/!(ember-addon)-test.js\"", + "test:unit": "cross-env DEBUG=ember-cli-update,git-diff-apply,git-fixtures mocha \"test/unit/**/!(ember-addon)-test.js\"", "test": "npm run test:both", "test:both": "npm run test:bin && npm run test:command", "test:bin": "cross-env DEBUG=ember-cli-update,git-diff-apply,git-fixtures mocha \"test/!(fixtures)/**/!(ember-addon)-test.js\"", diff --git a/test/acceptance/ember-cli-update-test.js b/test/acceptance/ember-cli-update-test.js index 6751a572d..3c13029e5 100644 --- a/test/acceptance/ember-cli-update-test.js +++ b/test/acceptance/ember-cli-update-test.js @@ -83,72 +83,72 @@ describe('Acceptance - ember-cli-update', function() { }); }); - it('updates addon', function() { - return merge({ - fixturesPath: 'test/fixtures/local/my-addon' - }).promise.then(({ - status - }) => { - fixtureCompare({ - mergeFixtures: 'test/fixtures/merge/my-addon' - }); - - assertNormalUpdate(status); - assertNoUnstaged(status); - }); - }); - - (shouldSkipCodemods ? it.skip : it)('runs codemods', function() { - this.timeout(5 * 60 * 1000); - - let { - ps, - promise - } = merge({ - fixturesPath: 'test/fixtures/merge/my-app', - runCodemods: true - }); - - ps.stdout.on('data', data => { - let str = data.toString(); - if (str.includes('These codemods apply to your project.')) { - ps.stdin.write('a\n'); - } - }); - - return promise.then(({ - status - }) => { - // file is indeterminent between OS's, so ignore - fs.removeSync(path.join(tmpPath, 'MODULE_REPORT.md')); - - let mergeFixtures = 'test/fixtures/codemod/latest-node/my-app'; - if (process.env.NODE_LTS) { - mergeFixtures = 'test/fixtures/codemod/min-node/my-app'; - } - - fixtureCompare({ - mergeFixtures - }); - - assertNoUnstaged(status); - assertCodemodRan(status); - }); - }); - - it('scopes to sub dir if run from there', function() { - return merge({ - fixturesPath: 'test/fixtures/local/my-app', - subDir: 'foo/bar' - }).promise.then(({ - status - }) => { - fixtureCompare({ - mergeFixtures: 'test/fixtures/merge/my-app' - }); - - assertNormalUpdate(status); - assertNoUnstaged(status); - }); - }); + // it('updates addon', function() { + // return merge({ + // fixturesPath: 'test/fixtures/local/my-addon' + // }).promise.then(({ + // status + // }) => { + // fixtureCompare({ + // mergeFixtures: 'test/fixtures/merge/my-addon' + // }); + + // assertNormalUpdate(status); + // assertNoUnstaged(status); + // }); + // }); + + // (shouldSkipCodemods ? it.skip : it)('runs codemods', function() { + // this.timeout(5 * 60 * 1000); + + // let { + // ps, + // promise + // } = merge({ + // fixturesPath: 'test/fixtures/merge/my-app', + // runCodemods: true + // }); + + // ps.stdout.on('data', data => { + // let str = data.toString(); + // if (str.includes('These codemods apply to your project.')) { + // ps.stdin.write('a\n'); + // } + // }); + + // return promise.then(({ + // status + // }) => { + // // file is indeterminent between OS's, so ignore + // fs.removeSync(path.join(tmpPath, 'MODULE_REPORT.md')); + + // let mergeFixtures = 'test/fixtures/codemod/latest-node/my-app'; + // if (process.env.NODE_LTS) { + // mergeFixtures = 'test/fixtures/codemod/min-node/my-app'; + // } + + // fixtureCompare({ + // mergeFixtures + // }); + + // assertNoUnstaged(status); + // assertCodemodRan(status); + // }); + // }); + + // it('scopes to sub dir if run from there', function() { + // return merge({ + // fixturesPath: 'test/fixtures/local/my-app', + // subDir: 'foo/bar' + // }).promise.then(({ + // status + // }) => { + // fixtureCompare({ + // mergeFixtures: 'test/fixtures/merge/my-app' + // }); + + // assertNormalUpdate(status); + // assertNoUnstaged(status); + // }); + // }); }); diff --git a/test/helpers/build-tmp.js b/test/helpers/build-tmp.js index 96a58fd50..69991162c 100644 --- a/test/helpers/build-tmp.js +++ b/test/helpers/build-tmp.js @@ -17,7 +17,14 @@ module.exports = function({ subDir = '', npmInstall }) { - let tmpPath = tmp.dirSync().name; + let tmpPath; + if (process.env.AGENT_TEMPDIRECTORY) { + console.log("Detected Azure Pipelines, using agent temp dir"); + tmpPath = tmp.dirSync({ dir: process.env.AGENT_TEMPDIRECTORY }).name; + } else { + console.log("Not using Azure Pipelines..."); + tmpPath = tmp.dirSync().name; + } gitInit({ cwd: tmpPath