Skip to content

Commit

Permalink
feat(javascript-mutator): allow decorators (#1474)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicojs authored Apr 4, 2019
1 parent fb7390b commit f0dd430
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/javascript-mutator/src/helpers/BabelHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export default class BabelHelper {
'dynamicImport',
'flow',
'jsx',
'objectRestSpread'
'objectRestSpread',
['decorators', { decoratorsBeforeExport: true }] as any,
],
sourceType: 'unambiguous'
};
Expand Down
13 changes: 13 additions & 0 deletions packages/javascript-mutator/test/unit/JavaScriptMutator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,17 @@ describe('JavaScriptMutator', () => {

expect(mutants.length).to.equal(2);
});

it('should generate mutants when file contains a decorator', () => {
const sut = createSut();
const files: File[] = [new File('testFile.js', `
@decorator()
export class Foo {
bar = 'bar';
};
`)];

const mutants = sut.mutate(files);
expect(mutants).lengthOf.above(0);
});
});

0 comments on commit f0dd430

Please sign in to comment.