Skip to content
/ jest Public
forked from jestjs/jest

Commit

Permalink
Add tests for a few other babel config methods
Browse files Browse the repository at this point in the history
  • Loading branch information
bradfordlemley committed Feb 4, 2019
1 parent 4070442 commit 4d2ebc4
Show file tree
Hide file tree
Showing 24 changed files with 97 additions and 24 deletions.
37 changes: 28 additions & 9 deletions e2e/__tests__/multiProjectRunner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,20 +499,39 @@ describe("doesn't bleed module file extensions resolution with multiple workers"
});

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');
it('Prj-1 works individually', () => {
const result = runJest('multi-project-babel/prj-1');
expect(result.stderr).toMatch('PASS ./index.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');
it('Prj-2 works individually', () => {
const result = runJest('multi-project-babel/prj-2');
expect(result.stderr).toMatch('PASS ./index.test.js');
expect(result.status).toBe(0);
});
it('Transpiles when running from multiproject', () => {
it('Prj-3 works individually', () => {
const result = runJest('multi-project-babel/prj-3');
expect(result.stderr).toMatch('PASS src/index.test.js');
expect(result.status).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.status).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.status).toBe(0);
});
it('All project work 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.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.status).toBe(0);
});
});
6 changes: 0 additions & 6 deletions e2e/multi-project-babel/bar/bar.test.js

This file was deleted.

6 changes: 0 additions & 6 deletions e2e/multi-project-babel/foo/foo.test.js

This file was deleted.

9 changes: 6 additions & 3 deletions e2e/multi-project-babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
"jest": {
"projects": [
{
"rootDir": "<rootDir>/foo"
"rootDir": "<rootDir>/prj-1"
},
{
"rootDir": "<rootDir>/bar"
}
"rootDir": "<rootDir>/prj-2"
},
"<rootDir>/prj-3",
"<rootDir>/prj-4",
"<rootDir>/prj-5"
]
}
}
File renamed without changes.
File renamed without changes.
6 changes: 6 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,6 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
const f = require('./');

it('Transpiles', () => {
expect(f('test')).toBe('test');
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 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,6 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
const f = require('./');

it('Transpiles', () => {
expect(f('test')).toBe('test');
});
File renamed without changes.
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"
}
}
4 changes: 4 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,4 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
module.exports = {
presets: ['@babel/preset-flow'],
};
2 changes: 2 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,2 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
module.exports = (text: string) => text;
6 changes: 6 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,6 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
const f = require('./');

it('Transpiles', () => {
expect(f('test')).toBe('test');
});
4 changes: 4 additions & 0 deletions e2e/multi-project-babel/prj-4/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
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"
}
}
2 changes: 2 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,2 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
module.exports = (text: string) => text;
6 changes: 6 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,6 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
const f = require('./');

it('Transpiles', () => {
expect(f('test')).toBe('test');
});
4 changes: 4 additions & 0 deletions e2e/multi-project-babel/prj-5/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
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"
}
}
2 changes: 2 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,2 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
module.exports = (text: string) => text;
6 changes: 6 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,6 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
const f = require('./');

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

0 comments on commit 4d2ebc4

Please sign in to comment.