Skip to content
/ jest Public
forked from jestjs/jest

Commit

Permalink
Add test demonstrating babel behavior difference individually vs. mul…
Browse files Browse the repository at this point in the history
…tiprj
  • Loading branch information
bradfordlemley committed Feb 3, 2019
1 parent 74ae342 commit 0dc6df1
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 0 deletions.
19 changes: 19 additions & 0 deletions e2e/__tests__/multiProjectRunner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
3 changes: 3 additions & 0 deletions e2e/multi-project-babel/bar/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-flow'],
};
1 change: 1 addition & 0 deletions e2e/multi-project-babel/bar/bar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = (text: string) => text;
6 changes: 6 additions & 0 deletions e2e/multi-project-babel/bar/bar.test.js
Original file line number Diff line number Diff line change
@@ -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');
});
1 change: 1 addition & 0 deletions e2e/multi-project-babel/bar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions e2e/multi-project-babel/foo/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-flow'],
};
1 change: 1 addition & 0 deletions e2e/multi-project-babel/foo/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = (text: string) => text;
6 changes: 6 additions & 0 deletions e2e/multi-project-babel/foo/foo.test.js
Original file line number Diff line number Diff line change
@@ -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');
});
1 change: 1 addition & 0 deletions e2e/multi-project-babel/foo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
12 changes: 12 additions & 0 deletions e2e/multi-project-babel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"jest": {
"projects": [
{
"rootDir": "<rootDir>/foo"
},
{
"rootDir": "<rootDir>/bar"
}
]
}
}

0 comments on commit 0dc6df1

Please sign in to comment.