diff --git a/bulk-decaffeinate.config.js b/bulk-decaffeinate.config.js index 8120ef9cf4b0..e7af5f254a2d 100644 --- a/bulk-decaffeinate.config.js +++ b/bulk-decaffeinate.config.js @@ -18,6 +18,5 @@ module.exports = { './scripts/decaff/empty-catch.js', './scripts/decaff/no-cond-assign.js', './scripts/decaff/arrow-comment.js', - './scripts/decaff/test-no-return.js', ], } diff --git a/scripts/decaff/__testfixtures__/test-no-return.input.js b/scripts/decaff/__testfixtures__/test-no-return.input.js deleted file mode 100644 index 07c28501686f..000000000000 --- a/scripts/decaff/__testfixtures__/test-no-return.input.js +++ /dev/null @@ -1,24 +0,0 @@ -context('a', function () { - beforeEach(() => { - doSomething() - - return settings.write('something') - }) - - afterEach(() => { - return settings.reset() - }) - - it('test 1', function () { - cy.visit('hi/world') - - return cy.click('abc') - }) - - it('test 2', () => { - return this.project.saveState() - .then((state) => { - expect(state).to.deep.eq({}) - }) - }) -}) diff --git a/scripts/decaff/__testfixtures__/test-no-return.output.js b/scripts/decaff/__testfixtures__/test-no-return.output.js deleted file mode 100644 index e157967c67b0..000000000000 --- a/scripts/decaff/__testfixtures__/test-no-return.output.js +++ /dev/null @@ -1,24 +0,0 @@ -context('a', function () { - beforeEach(() => { - doSomething() - - settings.write('something'); - }) - - afterEach(() => { - settings.reset(); - }) - - it('test 1', function () { - cy.visit('hi/world') - - cy.click('abc'); - }) - - it('test 2', () => { - this.project.saveState() - .then((state) => { - expect(state).to.deep.eq({}) - }); - }) -}) diff --git a/scripts/decaff/__tests__/decaff.test.js b/scripts/decaff/__tests__/decaff.test.js index c613a1a0582b..4921d9b52b37 100644 --- a/scripts/decaff/__tests__/decaff.test.js +++ b/scripts/decaff/__tests__/decaff.test.js @@ -8,4 +8,3 @@ defineTest(__dirname, 'empty-catch') defineTest(__dirname, 'remove-comment-sharp') defineTest(__dirname, 'arrow-comment') defineTest(__dirname, 'no-cond-assign') -defineTest(__dirname, 'test-no-return') diff --git a/scripts/decaff/test-no-return.js b/scripts/decaff/test-no-return.js deleted file mode 100644 index f3d39398ddbc..000000000000 --- a/scripts/decaff/test-no-return.js +++ /dev/null @@ -1,51 +0,0 @@ -module.exports = (fileInfo, api) => { - const funcs = [ - { name: 'beforeEach', index: 0 }, - { name: 'afterEach', index: 0 }, - { name: 'it', index: 1 }, - ] - - const j = api.jscodeshift - - const removeReturn = (src, name, index) => { - return j(src) - .find(j.ExpressionStatement, { - expression: { - callee: { - type: 'Identifier', - name, - }, - }, - }) - .replaceWith(({ node }) => { - let block = node.expression.arguments[index].body - - if (block.body && block.body.length > 0) { - block.body = block.body.map((s) => { - if (s.type === 'ReturnStatement') { - const stat = j.expressionStatement(s.argument) - - if (s.comments) { - stat.comments = s.comments - } - - return stat - } - - return s - }) - } - - return node - }) - .toSource() - } - - let src = fileInfo.source - - funcs.forEach(({ name, index }) => { - src = removeReturn(src, name, index) - }) - - return src -}