Skip to content

Commit

Permalink
feat(jest): Add Jest
Browse files Browse the repository at this point in the history
  • Loading branch information
Donskelle committed Apr 20, 2020
1 parent ded442a commit 81a8c75
Show file tree
Hide file tree
Showing 13 changed files with 5,972 additions and 1,615 deletions.
1 change: 1 addition & 0 deletions config/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// mock stuff here
11 changes: 0 additions & 11 deletions index.js

This file was deleted.

8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
roots: ["<rootDir>/src"],
testMatch: [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)",
],
setupFiles: ["<rootDir>/config/jest.setup.js"],
};
7,522 changes: 5,927 additions & 1,595 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "@donskelle/pwa-helpers",
"version": "0.1.4",
"description": "git packages test",
"module": "index.js",
"module": "src/index.js",
"scripts": {
"release": "npx release-it",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "npx jest"
},
"repository": {
"type": "git",
Expand All @@ -21,6 +21,7 @@
"registry": "https://npm.pkg.github.com/"
},
"devDependencies": {
"jest": "^25.4.0",
"release-it": "^13.5.4"
},
"release-it": {
Expand Down
7 changes: 0 additions & 7 deletions src/freeFrame.js

This file was deleted.

7 changes: 7 additions & 0 deletions src/idleFrame/idleFrame.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const idleFrameCallback = (cb) =>
(window.requestIdleCallback || window.setTimeout)(cb);

const idleFramePromise = () =>
new Promise((resolve) => idleFrameCallback(resolve));

export { idleFrameCallback, idleFramePromise };
3 changes: 3 additions & 0 deletions src/idleFrame/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { idleFrameCallback, idleFrameCallback } from "./idleFrame";

export { idleFrameCallback, idleFrameCallback };
14 changes: 14 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
preventPwaInstallAndSavePrompt,
preventedInstallCallback,
} from "./preventedInstallCallback";
import { updateFoundCallback } from "./updateFoundCallback";
import { idleFrameCallback, idleFramePromise } from "./idleFrame";

export {
preventPwaInstallAndSavePrompt,
preventedInstallCallback,
updateFoundCallback,
idleFrameCallback,
idleFramePromise,
};
6 changes: 6 additions & 0 deletions src/preventedInstallCallback/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {
preventPwaInstallAndSavePrompt,
preventedInstallCallback,
} from "./preventedInstallCallback";

export { preventPwaInstallAndSavePrompt, preventedInstallCallback };
File renamed without changes.
3 changes: 3 additions & 0 deletions src/updateFoundCallback/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { updateFoundCallback } from "./updateFoundCallback";

export { updateFoundCallback };
File renamed without changes.

0 comments on commit 81a8c75

Please sign in to comment.