@@ -485,6 +485,70 @@ QUnit.module('codemod-cli', function(hooks) {
485485 } ) ;
486486 } ) ;
487487
488+ QUnit . test ( 'should ignore patterns from configuration option' , async function ( assert ) {
489+ codemodProject . write ( {
490+ transforms : {
491+ main : {
492+ 'index.js' : `
493+ module.exports = function transformer(file, api) {
494+ return file.source.toUpperCase();
495+ }
496+ ` ,
497+ } ,
498+ } ,
499+ } ) ;
500+
501+ userProject . write ( {
502+ foo : { 'something.hbs' : `<Foo />` } ,
503+ bar : { 'something.hbs' : `<Foo />` } ,
504+ } ) ;
505+
506+ await CodemodCLI . runTransform (
507+ codemodProject . path ( 'bin' ) ,
508+ 'main' ,
509+ [ 'foo/**' , 'bar/**' , '--ignore-pattern' , 'foo/' ] ,
510+ 'hbs'
511+ ) ;
512+
513+ assert . deepEqual ( userProject . read ( ) , {
514+ foo : { 'something.hbs' : `<Foo />` } ,
515+ bar : { 'something.hbs' : `<FOO />` } ,
516+ } ) ;
517+ } ) ;
518+
519+ QUnit . test ( 'should ignore patterns from configuration file' , async function ( assert ) {
520+ codemodProject . write ( {
521+ transforms : {
522+ main : {
523+ 'index.js' : `
524+ module.exports = function transformer(file, api) {
525+ return file.source.toUpperCase();
526+ }
527+ ` ,
528+ } ,
529+ } ,
530+ } ) ;
531+
532+ userProject . write ( {
533+ config : { '.gitignore' : `foo/` } ,
534+ foo : { 'something.hbs' : `<Foo />` } ,
535+ bar : { 'something.hbs' : `<Foo />` } ,
536+ } ) ;
537+
538+ await CodemodCLI . runTransform (
539+ codemodProject . path ( 'bin' ) ,
540+ 'main' ,
541+ [ 'foo/**' , 'bar/**' , '--ignore-config' , 'config/.gitignore' ] ,
542+ 'hbs'
543+ ) ;
544+
545+ assert . deepEqual ( userProject . read ( ) , {
546+ config : { '.gitignore' : `foo/` } ,
547+ foo : { 'something.hbs' : `<Foo />` } ,
548+ bar : { 'something.hbs' : `<FOO />` } ,
549+ } ) ;
550+ } ) ;
551+
488552 QUnit . test ( 'runs transform against class syntax' , async function ( assert ) {
489553 userProject . write ( {
490554 foo : {
0 commit comments