Skip to content

Commit 4ddb5eb

Browse files
author
Robert Jackson
committed
Add test for specifying custom extensions.
1 parent 221c262 commit 4ddb5eb

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

tests/cli-test.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ QUnit.module('codemod-cli', function(hooks) {
375375
},
376376
},
377377
});
378+
378379
userProject.write({
379380
foo: { 'something.js': `let blah = "bar";` },
380381
});
@@ -392,6 +393,34 @@ QUnit.module('codemod-cli', function(hooks) {
392393
});
393394
});
394395

396+
QUnit.test('can specify additional extensions to run against', async function(assert) {
397+
codemodProject.write({
398+
transforms: {
399+
main: {
400+
'index.js': `
401+
module.exports = function transformer(file, api) {
402+
return file.source.toUpperCase();
403+
}
404+
`,
405+
},
406+
},
407+
});
408+
409+
userProject.write({
410+
foo: { 'something.hbs': `<Foo />` },
411+
});
412+
413+
await CodemodCLI.runTransform(codemodProject.path('bin'), 'main', [
414+
'--extensions',
415+
'hbs',
416+
'foo/**',
417+
]);
418+
419+
assert.deepEqual(userProject.read(), {
420+
foo: { 'something.hbs': `<FOO />` },
421+
});
422+
});
423+
395424
QUnit.test('runs transform against class syntax', async function(assert) {
396425
userProject.write({
397426
foo: {

0 commit comments

Comments
 (0)