From 2cfa118b71436c411706710ac1914c5bdece4901 Mon Sep 17 00:00:00 2001 From: Kelly Selden Date: Sun, 17 Nov 2019 22:38:13 +0000 Subject: [PATCH] supporting test modifications --- test/tests.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/test/tests.js b/test/tests.js index d95690c..f08eec8 100644 --- a/test/tests.js +++ b/test/tests.js @@ -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; @@ -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.')) { @@ -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'; @@ -122,9 +137,6 @@ describe('runs codemods', function() { fixtureCompare({ mergeFixtures }); - - assertNoUnstaged(status); - assertCodemodRan(status); }); } });