Skip to content

Commit

Permalink
supporting test modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Selden committed Nov 18, 2019
1 parent a7b35a5 commit 2cfa118
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ const {
assertCodemodRan
} = require('./helpers/assertions');
const manifest = require('../manifest');
const run = require('ember-cli-update/src/run');

const codemods = Object.keys(manifest);

describe('runs codemods', function() {
this.timeout(5 * 60 * 1000);
this.timeout(10 * 60 * 1000);

let tmpPath;

Expand Down Expand Up @@ -83,9 +84,15 @@ describe('runs codemods', function() {
runCodemods: true,
async beforeMerge() {
await _merge('local', tmpPath);

if (manifest[codemod].script) {
await run('npm install', { cwd: tmpPath });
}
}
});

ps.stdout.pipe(process.stdout);

function stdoutData(data) {
let str = data.toString();
if (str.includes('These codemods apply to your project.')) {
Expand All @@ -104,9 +111,17 @@ describe('runs codemods', function() {
status
} = await promise;

assertNoUnstaged(status);
assertCodemodRan(status);

await fs.remove(path.join(tmpPath, 'package-lock.json'));

// file is indeterminent between OS's, so ignore
await fs.remove(path.join(tmpPath, 'MODULE_REPORT.md'));

// remove dist and node_modules before fixture compare
await run('git clean -fdX', { cwd: tmpPath });

let nodeVersion = 'latest-node';
if (process.env.NODE_LTS) {
nodeVersion = 'min-node';
Expand All @@ -122,9 +137,6 @@ describe('runs codemods', function() {
fixtureCompare({
mergeFixtures
});

assertNoUnstaged(status);
assertCodemodRan(status);
});
}
});

0 comments on commit 2cfa118

Please sign in to comment.