Skip to content
/ jest Public
forked from jestjs/jest

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 0b5c1d0d2d8568e7e7e5cdab46690f9ccf4eaad1
Merge: 4d2ebc4 49a5eca
Author: Simen Bekkhus <sbekkhus91@gmail.com>
Date:   Tue Apr 19 15:03:01 2022 +0200

    Merge branch 'main' into multiprj-babel

commit 4d2ebc4
Author: Bradford Lemley <bradfordlemley@gmail.com>
Date:   Mon Feb 4 10:29:31 2019 -0700

    Add tests for a few other babel config methods

commit 4070442
Author: Bradford Lemley <bradfordlemley@gmail.com>
Date:   Mon Feb 4 08:14:39 2019 -0700

    Apply patch from jestjs#7794 (comment).

commit 51d008c
Author: Bradford Lemley <bradfordlemley@gmail.com>
Date:   Sun Feb 3 11:03:28 2019 -0700

    Configure babel cwd to be project rootDir

commit 0dc6df1
Author: Bradford Lemley <bradfordlemley@gmail.com>
Date:   Sun Feb 3 15:08:05 2019 -0700

    Add test demonstrating babel behavior difference individually vs. multiprj
  • Loading branch information
SimenB committed Apr 19, 2022
1 parent 71b8d20 commit 5bad98b
Show file tree
Hide file tree
Showing 22 changed files with 220 additions and 0 deletions.
38 changes: 38 additions & 0 deletions e2e/__tests__/multiProjectRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,3 +572,41 @@ 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('Prj-1 works individually', () => {
const result = runJest('multi-project-babel/prj-1');
expect(result.stderr).toMatch('PASS ./index.test.js');
expect(result.exitCode).toBe(0);
});
it('Prj-2 works individually', () => {
const result = runJest('multi-project-babel/prj-2');
expect(result.stderr).toMatch('PASS ./index.test.js');
expect(result.exitCode).toBe(0);
});
it('Prj-3 works individually', () => {
const result = runJest('multi-project-babel/prj-3');
expect(result.stderr).toMatch('PASS src/index.test.js');
expect(result.exitCode).toBe(0);
});
it('Prj-4 works individually', () => {
const result = runJest('multi-project-babel/prj-4');
expect(result.stderr).toMatch('PASS src/index.test.js');
expect(result.exitCode).toBe(0);
});
it('Prj-5 works individually', () => {
const result = runJest('multi-project-babel/prj-5');
expect(result.stderr).toMatch('PASS src/index.test.js');
expect(result.exitCode).toBe(0);
});
it('All project work when running from multiproject', () => {
const result = runJest('multi-project-babel');
expect(result.stderr).toMatch('PASS prj-1/index.test.js');
expect(result.stderr).toMatch('PASS prj-2/index.test.js');
expect(result.stderr).toMatch('PASS prj-3/src/index.test.js');
expect(result.stderr).toMatch('PASS prj-4/src/index.test.js');
expect(result.stderr).toMatch('PASS prj-5/src/index.test.js');
expect(result.stderr).toMatch('PASS prj-3/src/index.test.js');
expect(result.exitCode).toBe(0);
});
});
15 changes: 15 additions & 0 deletions e2e/multi-project-babel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"jest": {
"projects": [
{
"rootDir": "<rootDir>/prj-1"
},
{
"rootDir": "<rootDir>/prj-2"
},
"<rootDir>/prj-3",
"<rootDir>/prj-4",
"<rootDir>/prj-5"
]
}
}
10 changes: 10 additions & 0 deletions e2e/multi-project-babel/prj-1/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = {
presets: ['@babel/preset-flow'],
};
8 changes: 8 additions & 0 deletions e2e/multi-project-babel/prj-1/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = (text: string) => text;
12 changes: 12 additions & 0 deletions e2e/multi-project-babel/prj-1/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const f = require('./');

it('Transpiles', () => {
expect(f('test')).toBe('test');
});
1 change: 1 addition & 0 deletions e2e/multi-project-babel/prj-1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
10 changes: 10 additions & 0 deletions e2e/multi-project-babel/prj-2/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = {
presets: ['@babel/preset-flow'],
};
8 changes: 8 additions & 0 deletions e2e/multi-project-babel/prj-2/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = (text: string) => text;
12 changes: 12 additions & 0 deletions e2e/multi-project-babel/prj-2/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const f = require('./');

it('Transpiles', () => {
expect(f('test')).toBe('test');
});
1 change: 1 addition & 0 deletions e2e/multi-project-babel/prj-2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions e2e/multi-project-babel/prj-3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jest": {
"rootDir": "src"
}
}
10 changes: 10 additions & 0 deletions e2e/multi-project-babel/prj-3/src/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = {
presets: ['@babel/preset-flow'],
};
8 changes: 8 additions & 0 deletions e2e/multi-project-babel/prj-3/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = (text: string) => text;
12 changes: 12 additions & 0 deletions e2e/multi-project-babel/prj-3/src/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const f = require('./');

it('Transpiles', () => {
expect(f('test')).toBe('test');
});
10 changes: 10 additions & 0 deletions e2e/multi-project-babel/prj-4/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = {
presets: ['@babel/preset-flow'],
};
5 changes: 5 additions & 0 deletions e2e/multi-project-babel/prj-4/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jest": {
"rootDir": "src"
}
}
8 changes: 8 additions & 0 deletions e2e/multi-project-babel/prj-4/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = (text: string) => text;
12 changes: 12 additions & 0 deletions e2e/multi-project-babel/prj-4/src/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const f = require('./');

it('Transpiles', () => {
expect(f('test')).toBe('test');
});
10 changes: 10 additions & 0 deletions e2e/multi-project-babel/prj-5/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = {
presets: ['@babel/preset-flow'],
};
5 changes: 5 additions & 0 deletions e2e/multi-project-babel/prj-5/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jest": {
"rootDir": "src"
}
}
8 changes: 8 additions & 0 deletions e2e/multi-project-babel/prj-5/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = (text: string) => text;
12 changes: 12 additions & 0 deletions e2e/multi-project-babel/prj-5/src/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const f = require('./');

it('Transpiles', () => {
expect(f('test')).toBe('test');
});

0 comments on commit 5bad98b

Please sign in to comment.