Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jest-runner): Support multi project jest-configs #2780

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
567 changes: 558 additions & 9 deletions e2e/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"@babel/core": "~7.8.3",
"@babel/plugin-proposal-class-properties": "~7.8.3",
"@babel/plugin-proposal-pipeline-operator": "~7.8.3",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "~7.8.3",
"@babel/preset-flow": "7.12.13",
"@babel/preset-react": "^7.12.13",
"@types/node": "^10.12.18",
"@types/semver": "~6.2.0",
"ajv": "~7.0.2",
Expand Down
9 changes: 9 additions & 0 deletions e2e/test/jest-multiple-projects/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
],
"presets": [
"@babel/env"
]
}
1 change: 1 addition & 0 deletions e2e/test/jest-multiple-projects/__mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "test-file-stub";
6 changes: 6 additions & 0 deletions e2e/test/jest-multiple-projects/client/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../.babelrc",
"presets": [
"@babel/preset-react"
]
}
24 changes: 24 additions & 0 deletions e2e/test/jest-multiple-projects/client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"browser": true
},
"extends": [
"plugin:jsx-a11y/strict",
"plugin:react/recommended"
],
"plugins": [
"react-hooks"
],
"rules": {
"react/jsx-tag-spacing": "error",
"react/no-unused-prop-types": "error",
"react/prop-types": "error",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error"
},
"settings": {
"react": {
"version": "detect"
}
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

export class HelloComponent extends HTMLElement {
connectedCallback() {
this.innerText = 'hello world';
}
}
window.customElements.define('jest-hello', HelloComponent);
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import './hello-component';

describe('hello-component', () => {

fit('should show a "hello world" message', () => {
const element = document.createElement('jest-hello');
document.body.appendChild(element);
expect(element.innerText).toEqual('hello world');
document.body.removeChild(element);
});
});
22 changes: 22 additions & 0 deletions e2e/test/jest-multiple-projects/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
projects: [
{
displayName: "client",
setupFilesAfterEnv: [
"<rootDir>/client/setupTests.js",
],
testEnvironment: "jsdom",
testMatch: [
"<rootDir>/client/**/*.test.js",
],
},
{
displayName: "server",
testEnvironment: "node",
testMatch: [
"<rootDir>/server/**/*.test.js",
],
},
],
testRunner: "jest-circus/runner",
};
Loading