Skip to content

Commit

Permalink
fix: upgrade esbuild-jest to support jest mocks (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
pradel authored Feb 27, 2021
1 parent 49a9b1d commit 68dae43
Show file tree
Hide file tree
Showing 19 changed files with 200 additions and 449 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
examples
CHANGELOG.md
68 changes: 0 additions & 68 deletions examples/with-javascript/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/with-javascript/craco.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const CracoEsbuildPlugin = require("craco-esbuild");
const CracoEsbuildPlugin = require('craco-esbuild');

module.exports = {
plugins: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const jestMockWorking = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const jestMockWorking = false;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { jestMockWorking } from './jest-mocks';

jest.mock('./jest-mocks');

test('Value should be true if mocks is working', () => {
expect(jestMockWorking).toBe(true);
});
6 changes: 0 additions & 6 deletions examples/with-javascript/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
141 changes: 0 additions & 141 deletions examples/with-javascript/src/serviceWorker.js

This file was deleted.

44 changes: 0 additions & 44 deletions examples/with-typescript/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/with-typescript/craco.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const CracoEsbuildPlugin = require("craco-esbuild");
const CracoEsbuildPlugin = require('craco-esbuild');

module.exports = {
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion examples/with-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.2",
"typescript": "~4.1.3"
"typescript": "~4.1.5"
},
"scripts": {
"start": "craco start",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const jestMockWorking = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { jestMockWorking } from './jest-mocks';

jest.mock('./jest-mocks');

test('Value should be true if mocks is working', () => {
expect(jestMockWorking).toBe(true);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const jestMockWorking = false;
6 changes: 0 additions & 6 deletions examples/with-typescript/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
Loading

0 comments on commit 68dae43

Please sign in to comment.