diff --git a/fixtures/smoke/issue-5176-flow-class-properties/index.test.js b/fixtures/smoke/issue-5176-flow-class-properties/index.test.js
new file mode 100644
index 00000000000..72a7a3daf0e
--- /dev/null
+++ b/fixtures/smoke/issue-5176-flow-class-properties/index.test.js
@@ -0,0 +1,13 @@
+const { bootstrap, isSuccessfulTest } = require('../../utils');
+beforeEach(async () => {
+ await bootstrap({ directory: global.testDirectory, template: __dirname });
+});
+
+describe('issue #5176 (flow class properties interaction)', () => {
+ it('passes tests', async () => {
+ await isSuccessfulTest({
+ directory: global.testDirectory,
+ jestEnvironment: 'node',
+ });
+ });
+});
diff --git a/fixtures/smoke/issue-5176-flow-class-properties/package.json b/fixtures/smoke/issue-5176-flow-class-properties/package.json
new file mode 100644
index 00000000000..0967ef424bc
--- /dev/null
+++ b/fixtures/smoke/issue-5176-flow-class-properties/package.json
@@ -0,0 +1 @@
+{}
diff --git a/fixtures/smoke/issue-5176-flow-class-properties/public/index.html b/fixtures/smoke/issue-5176-flow-class-properties/public/index.html
new file mode 100644
index 00000000000..86010b24067
--- /dev/null
+++ b/fixtures/smoke/issue-5176-flow-class-properties/public/index.html
@@ -0,0 +1,9 @@
+
+
+
+ React App
+
+
+
+
+
diff --git a/fixtures/smoke/issue-5176-flow-class-properties/src/App.js b/fixtures/smoke/issue-5176-flow-class-properties/src/App.js
new file mode 100644
index 00000000000..c6a68613b58
--- /dev/null
+++ b/fixtures/smoke/issue-5176-flow-class-properties/src/App.js
@@ -0,0 +1,11 @@
+class App {
+ constructor() {
+ this.foo = this.foo.bind(this);
+ }
+ foo: void => void;
+ foo() {
+ return 'bar';
+ }
+}
+
+export default App;
diff --git a/fixtures/smoke/issue-5176-flow-class-properties/src/App.test.js b/fixtures/smoke/issue-5176-flow-class-properties/src/App.test.js
new file mode 100644
index 00000000000..4991b756f29
--- /dev/null
+++ b/fixtures/smoke/issue-5176-flow-class-properties/src/App.test.js
@@ -0,0 +1,6 @@
+import App from './App';
+
+it('creates instance without', () => {
+ const app = new App();
+ expect(app.foo()).toBe('bar');
+});
diff --git a/fixtures/smoke/jest.config.js b/fixtures/smoke/jest.config.js
index 9057ec0ea71..b2f8182ebd9 100644
--- a/fixtures/smoke/jest.config.js
+++ b/fixtures/smoke/jest.config.js
@@ -1,5 +1,6 @@
module.exports = {
testEnvironment: 'node',
testMatch: ['**/*.test.js'],
+ testPathIgnorePatterns: ['/src/', 'node_modules'],
setupTestFrameworkScriptFile: './setupSmokeTests.js',
};
diff --git a/fixtures/utils.js b/fixtures/utils.js
index 2bcab03c4a2..bde092f6e3e 100644
--- a/fixtures/utils.js
+++ b/fixtures/utils.js
@@ -14,7 +14,7 @@ async function bootstrap({ directory, template }) {
);
if (shouldInstallScripts) {
const packageJson = fs.readJsonSync(path.join(directory, 'package.json'));
- packageJson.dependencies = Object.assign(packageJson.dependencies, {
+ packageJson.dependencies = Object.assign({}, packageJson.dependencies, {
'react-scripts': 'latest',
});
fs.writeJsonSync(path.join(directory, 'package.json'), packageJson);
@@ -67,6 +67,17 @@ async function isSuccessfulProduction({ directory }) {
}
}
+async function isSuccessfulTest({ directory, jestEnvironment = 'jsdom' }) {
+ await execa(
+ './node_modules/.bin/react-scripts',
+ ['test', '--env', jestEnvironment, '--ci'],
+ {
+ cwd: directory,
+ env: { CI: 'true' },
+ }
+ );
+}
+
async function getOutputDevelopment({ directory, env = {} }) {
try {
const { stdout, stderr } = await execa(
@@ -128,6 +139,7 @@ module.exports = {
bootstrap,
isSuccessfulDevelopment,
isSuccessfulProduction,
+ isSuccessfulTest,
getOutputDevelopment,
getOutputProduction,
};