Skip to content

Commit 447599c

Browse files
author
Kelly Selden
committed
wip
1 parent 659bfd2 commit 447599c

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"--colors",
1616
"test/tests.js",
1717
"-f",
18-
"ember-modules-codemod"
18+
"ember-no-implicit-this-codemod"
1919
],
2020
"env": {
2121
"DEBUG": "ember-cli-update,boilerplate-update,git-diff-apply,git-fixtures"

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@
128128
},
129129
"projectOptions": ["app", "addon"],
130130
"nodeVersion": "8.0.0",
131-
"script": "let ps = execa.command('ember s', { stderr: 'inherit' }); ps.stdout.pipe(process.stdout); try { let url = await new Promise((resolve, reject) => { ps.stdout.on('data', data => { let str = data.toString(); let matches = str.match(/^Build successful \\(\\d+ms\\) – Serving on (.*)$/m); if (matches) { resolve(matches[1]); } }); ps.once('error', reject); ps.once('exit', reject); }); await execa.command(`npx ember-no-implicit-this-codemod ${url} app/`, { stdio: 'inherit' }); } finally { if (!ps.exitCode) { ps.kill(); await new Promise(resolve => { ps.once('exit', resolve); }); } }"
131+
"script": "let ps = execa.command(\"ember s\", { stderr: \"inherit\" }); ps.stdout.pipe(process.stdout); try { let url = await new Promise((resolve, reject) => { ps.stdout.on(\"data\", data => { let str = data.toString(); let matches = str.match(/^Build successful \\(\\d+ms\\) – Serving on (.*)$/m); if (matches) { resolve(matches[1]); } }); ps.once(\"error\", reject); ps.once(\"exit\", reject); }); await execa.command(`npx ember-no-implicit-this-codemod ${url} app/`, { stdio: \"inherit\" }); } finally { if (!ps.exitCode) { ps.kill(); await new Promise(resolve => { ps.once(\"exit\", resolve); }); } }"
132132
}
133133
}

test/tests.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ const {
1313
assertCodemodRan
1414
} = require('./helpers/assertions');
1515
const manifest = require('../manifest');
16+
const run = require('ember-cli-update/src/run');
1617

1718
const codemods = Object.keys(manifest);
1819

1920
describe('runs codemods', function() {
20-
this.timeout(5 * 60 * 1000);
21+
// this.timeout(10 * 60 * 1000);
2122

2223
let tmpPath;
2324

@@ -26,17 +27,18 @@ describe('runs codemods', function() {
2627
commitMessage,
2728
beforeMerge = () => Promise.resolve()
2829
}) {
29-
tmpPath = await buildTmp({
30-
fixturesPath
31-
});
30+
// tmpPath = await buildTmp({
31+
// fixturesPath
32+
// });
33+
tmpPath = "C:\\Users\\kelly\\AppData\\Local\\Temp\\tmp-12600ZNdscU6OkirE";
3234

3335
await beforeMerge();
3436

3537
return processBin({
3638
bin: 'ember-cli-update',
3739
args: [
3840
'--run-codemods',
39-
`--codemods-json='${JSON.stringify(manifest)}'`
41+
`--codemods-json='${JSON.stringify(manifest).replace(/\\"/g, '\\"')}'`
4042
],
4143
cwd: tmpPath,
4244
commitMessage,
@@ -82,10 +84,16 @@ describe('runs codemods', function() {
8284
commitMessage: 'my-app',
8385
runCodemods: true,
8486
async beforeMerge() {
85-
await _merge('local', tmpPath);
87+
// await _merge('local', tmpPath);
88+
89+
// await run('npm install', { cwd: tmpPath });
90+
91+
debugger;
8692
}
8793
});
8894

95+
// ps.stdout.pipe(process.stdout);
96+
8997
ps.stdout.on('data', data => {
9098
let str = data.toString();
9199
if (str.includes('These codemods apply to your project.')) {
@@ -100,9 +108,17 @@ describe('runs codemods', function() {
100108
status
101109
} = await promise;
102110

111+
assertNoUnstaged(status);
112+
assertCodemodRan(status);
113+
114+
await fs.remove(path.join(tmpPath, 'package-lock.json'));
115+
103116
// file is indeterminent between OS's, so ignore
104117
await fs.remove(path.join(tmpPath, 'MODULE_REPORT.md'));
105118

119+
// remove dist and node_modules before fixture compare
120+
await run('git clean -fdX', { cwd: tmpPath });
121+
106122
let nodeVersion = 'latest-node';
107123
if (process.env.NODE_LTS) {
108124
nodeVersion = 'min-node';
@@ -118,9 +134,6 @@ describe('runs codemods', function() {
118134
fixtureCompare({
119135
mergeFixtures
120136
});
121-
122-
assertNoUnstaged(status);
123-
assertCodemodRan(status);
124137
});
125138
}
126139
});

0 commit comments

Comments
 (0)