diff --git a/e2e/__tests__/multiProjectRunner.test.js b/e2e/__tests__/multiProjectRunner.test.js index 7fc070a53c32..da82fa10235a 100644 --- a/e2e/__tests__/multiProjectRunner.test.js +++ b/e2e/__tests__/multiProjectRunner.test.js @@ -497,3 +497,22 @@ describe("doesn't bleed module file extensions resolution with multiple workers" expect(stderr).toMatch('PASS project2/__tests__/project2.test.js'); }); }); + +describe('Babel config in individual project works in multi-project', () => { + it('Transpiles when running bar individually', () => { + const result = runJest('multi-project-babel/bar'); + expect(result.stderr).toMatch('PASS ./bar.test.js'); + expect(result.status).toBe(0); + }); + it('Transpiles when running foo individually', () => { + const result = runJest('multi-project-babel/foo'); + expect(result.stderr).toMatch('PASS ./foo.test.js'); + expect(result.status).toBe(0); + }); + it('Transpiles when running from multiproject', () => { + const result = runJest('multi-project-babel'); + expect(result.stderr).toMatch('PASS bar/bar.test.js'); + expect(result.stderr).toMatch('PASS foo/foo.test.js'); + expect(result.status).toBe(0); + }); +}); diff --git a/e2e/multi-project-babel/bar/.babelrc.js b/e2e/multi-project-babel/bar/.babelrc.js new file mode 100644 index 000000000000..6869642766b4 --- /dev/null +++ b/e2e/multi-project-babel/bar/.babelrc.js @@ -0,0 +1,3 @@ +module.exports = { + presets: ['@babel/preset-flow'], +}; diff --git a/e2e/multi-project-babel/bar/bar.js b/e2e/multi-project-babel/bar/bar.js new file mode 100644 index 000000000000..851a12a0a77c --- /dev/null +++ b/e2e/multi-project-babel/bar/bar.js @@ -0,0 +1 @@ +module.exports = (text: string) => text; diff --git a/e2e/multi-project-babel/bar/bar.test.js b/e2e/multi-project-babel/bar/bar.test.js new file mode 100644 index 000000000000..922937210429 --- /dev/null +++ b/e2e/multi-project-babel/bar/bar.test.js @@ -0,0 +1,6 @@ +// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +const bar = require('./bar'); + +it('Bar transpiles', () => { + expect(bar('test')).toBe('test'); +}); diff --git a/e2e/multi-project-babel/bar/package.json b/e2e/multi-project-babel/bar/package.json new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/e2e/multi-project-babel/bar/package.json @@ -0,0 +1 @@ +{} diff --git a/e2e/multi-project-babel/foo/.babelrc.js b/e2e/multi-project-babel/foo/.babelrc.js new file mode 100644 index 000000000000..6869642766b4 --- /dev/null +++ b/e2e/multi-project-babel/foo/.babelrc.js @@ -0,0 +1,3 @@ +module.exports = { + presets: ['@babel/preset-flow'], +}; diff --git a/e2e/multi-project-babel/foo/foo.js b/e2e/multi-project-babel/foo/foo.js new file mode 100644 index 000000000000..851a12a0a77c --- /dev/null +++ b/e2e/multi-project-babel/foo/foo.js @@ -0,0 +1 @@ +module.exports = (text: string) => text; diff --git a/e2e/multi-project-babel/foo/foo.test.js b/e2e/multi-project-babel/foo/foo.test.js new file mode 100644 index 000000000000..929edf4cd0c2 --- /dev/null +++ b/e2e/multi-project-babel/foo/foo.test.js @@ -0,0 +1,6 @@ +// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +const foo = require('./foo'); + +it('Foo transpiles', () => { + expect(foo('test')).toBe('test'); +}); diff --git a/e2e/multi-project-babel/foo/package.json b/e2e/multi-project-babel/foo/package.json new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/e2e/multi-project-babel/foo/package.json @@ -0,0 +1 @@ +{} diff --git a/e2e/multi-project-babel/package.json b/e2e/multi-project-babel/package.json new file mode 100644 index 000000000000..0c679cc796ea --- /dev/null +++ b/e2e/multi-project-babel/package.json @@ -0,0 +1,12 @@ +{ + "jest": { + "projects": [ + { + "rootDir": "/foo" + }, + { + "rootDir": "/bar" + } + ] + } +}