Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Add @babel/plugin-transform-flow-strip-types in favor of @babel/prese…
Browse files Browse the repository at this point in the history
…t-flow

#505
  • Loading branch information
KevinGrandon authored and fusion-bot[bot] committed Sep 5, 2018
1 parent 5070ce2 commit 09b075a
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 11 deletions.
4 changes: 3 additions & 1 deletion build/babel-plugins/babel-plugin-utils/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ test('with flow types', t => {
import type {footype} from 'bar';
let baz: string = foo();
`,
{plugins: [plugin], presets: [require('@babel/preset-flow')]}
{
plugins: [require('@babel/plugin-transform-flow-strip-types'), plugin],
}
);
});

Expand Down
2 changes: 1 addition & 1 deletion build/get-babel-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = function getBabelConfig(opts /*: BabelConfigOpts */) {
development: dev,
},
]);
config.presets.push(require('@babel/preset-flow'));
config.plugins.unshift(require('@babel/plugin-transform-flow-strip-types'));
if (fusionTransforms) {
config.presets.push([fusionPreset, {runtime, assumeNoImportSideEffects}]);
}
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "7.0.0",
"@babel/plugin-syntax-dynamic-import": "7.0.0",
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
"@babel/preset-env": "7.0.0",
"@babel/preset-flow": "7.0.0",
"@babel/preset-react": "7.0.0",
"@gfx/zopfli": "^1.0.8",
"babel-core": "^7.0.0-bridge.0",
Expand Down Expand Up @@ -63,7 +63,6 @@
"winston": "^3.0.0"
},
"devDependencies": {
"@babel/preset-flow": "7.0.0",
"babel-eslint": "9.0.0",
"chrome-remote-interface": "^0.26.1",
"enzyme": "3.5.0",
Expand Down
10 changes: 10 additions & 0 deletions test/cli/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ test('`fusion test` coverage', async t => {
t.end();
});

test('`fusion test` class properties', async t => {
const dir = path.resolve(__dirname, '../fixtures/test-jest-app');
const args = `test --dir=${dir} --configPath=../../../build/jest/jest-config.js --match=class-props`;

const cmd = `require('${runnerPath}').run('node ${runnerPath} ${args}')`;
const response = await exec(`node -e "${cmd}"`);
t.equal(countTests(response.stderr), 2, 'ran 2 tests');
t.end();
});

test('`fusion test` cobertura coverage reports', async t => {
const dir = path.resolve(__dirname, '../fixtures/test-jest-app');
const args = `test --dir=${dir} --configPath=../../../build/jest/jest-config.js --coverage --match=passes`;
Expand Down
13 changes: 13 additions & 0 deletions test/fixtures/test-jest-app/src/__tests__/class-props.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @flow
import {test} from 'fusion-test-utils';

import classPropFixture from '../class-props';

test('Class properties work /w flow annotation', async assert => {
const result = new classPropFixture();
assert.equal(
result.classProp(),
true,
'class props work and evaluates to true'
);
});
18 changes: 18 additions & 0 deletions test/fixtures/test-jest-app/src/class-props.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// @flow

import React, {Component} from 'react';

export default class ClassPropFixture {
// The following flow annotation is required in order to reproduce the failing test case (#505)
boundMethod: Function;

constructor() {
this.boundMethod = this.boundMethod.bind(this);
}

boundMethod(): void {}

classProp = () => {
return true;
};
}
7 changes: 0 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -613,13 +613,6 @@
js-levenshtein "^1.1.3"
semver "^5.3.0"

"@babel/[email protected]":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2"
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-transform-flow-strip-types" "^7.0.0"

"@babel/[email protected]":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.0.0.tgz#e86b4b3d99433c7b3e9e91747e2653958bc6b3c0"
Expand Down

0 comments on commit 09b075a

Please sign in to comment.