Skip to content

Commit

Permalink
Merge pull request #8 from rrigato/dev
Browse files Browse the repository at this point in the history
jest configuration to transpile react using jsdom
  • Loading branch information
rrigato authored Nov 4, 2023
2 parents ac0c815 + 9a8ada3 commit 697f4c2
Show file tree
Hide file tree
Showing 9 changed files with 1,941 additions and 93 deletions.
7 changes: 7 additions & 0 deletions static/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

export function App(){
return(
<h1>react initial setup</h1>
);
}
1 change: 1 addition & 0 deletions static/__mocks__/fileMocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
1 change: 1 addition & 0 deletions static/__mocks__/stylesMocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
6 changes: 6 additions & 0 deletions static/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
'@babel/preset-env',
['@babel/preset-react', {runtime: 'automatic'}],
],
};
3 changes: 2 additions & 1 deletion static/js/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { App } from '../App.jsx';



const root = createRoot(
document.getElementById('app-entry-point')
);
root.render(<h1>react initial setup</h1>);
root.render(<App/>);
2,007 changes: 1,917 additions & 90 deletions static/package-lock.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
"description": "personal homepage",
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-react": "^7.22.15",
"@testing-library/react": "^14.0.0",
"babel-loader": "^9.1.3",
"html-loader": "^4.2.0",
"html-webpack-plugin": "^5.5.3",
"jest": "^29.6.4",
"jest-environment-jsdom": "^29.7.0",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
Expand All @@ -20,6 +22,9 @@
"directories": {
"test": "tests"
},
"jest": {
"testEnvironment": "jsdom"
},
"homepage": "https://github.com/rrigato/homepage#readme",
"name": "homepage",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion static/tests/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render } from '@testing-library/react';
import {App} from '../App.jsx';

describe('entry point for app', () => {
test.skip('HomePageToggle called', () => {
test('HomePageToggle called', () => {


const renderedHomepage = render(<App/>);
Expand Down
2 changes: 1 addition & 1 deletion static/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
loader: 'html-loader',
},
{
test: /\.(?:js|cjs)$/,
test: /\.(?:js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
Expand Down

0 comments on commit 697f4c2

Please sign in to comment.