@stanlemon/webdev 0.1.38 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest.config.js +12 -2
- package/jest.setup.js +9 -0
- package/jest.test.js +2 -2
- package/package.json +2 -1
package/jest.config.js
CHANGED
|
@@ -8,6 +8,16 @@ const babelOptions = JSON.parse(
|
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
|
|
11
|
+
// These are packages we know ship with esmodules and need to be transformed
|
|
12
|
+
const esModules = [
|
|
13
|
+
"uuid",
|
|
14
|
+
"lowdb",
|
|
15
|
+
"steno",
|
|
16
|
+
"lodash-es",
|
|
17
|
+
"@stanlemon/server",
|
|
18
|
+
"@stanlemon/server-with-auth",
|
|
19
|
+
].join("|");
|
|
20
|
+
|
|
11
21
|
export default {
|
|
12
22
|
verbose: true,
|
|
13
23
|
setupFilesAfterEnv: [path.resolve(__dirname, "./jest.setup.js")],
|
|
@@ -15,8 +25,8 @@ export default {
|
|
|
15
25
|
transform: {
|
|
16
26
|
"^.+\\.(js|jsx|ts|tsx)?$": ["babel-jest", babelOptions],
|
|
17
27
|
},
|
|
18
|
-
//
|
|
19
|
-
transformIgnorePatterns: [
|
|
28
|
+
// Ignore transforms for node_modules, except...
|
|
29
|
+
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
|
|
20
30
|
moduleFileExtensions: ["js", "jsx", "ts", "tsx"],
|
|
21
31
|
moduleNameMapper: {
|
|
22
32
|
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
|
package/jest.setup.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
1
|
require("@testing-library/jest-dom");
|
|
2
|
+
|
|
3
|
+
const { Crypto } = require("@peculiar/webcrypto");
|
|
4
|
+
|
|
5
|
+
global.crypto = new Crypto();
|
|
6
|
+
|
|
7
|
+
if (!global.setImmediate) {
|
|
8
|
+
// This is as gross as it looks. It's a workaround for using PouchDB in tests.
|
|
9
|
+
global.setImmediate = global.setTimeout; // ts: as unknown as typeof setImmediate;
|
|
10
|
+
}
|
package/jest.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @jest-environment
|
|
2
|
+
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
|
-
// This package is already transformed
|
|
4
|
+
// This package is already transformed, and it uses crypto which is not supported in jsdom.
|
|
5
5
|
import { v1 as uuidv1 } from "uuid";
|
|
6
6
|
|
|
7
7
|
test("jest works", () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stanlemon/webdev",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"description": "My typical web development setup, but without all the copy and paste.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"@babel/preset-env": "^7.17.10",
|
|
25
25
|
"@babel/preset-react": "^7.16.7",
|
|
26
26
|
"@babel/preset-typescript": "^7.16.7",
|
|
27
|
+
"@peculiar/webcrypto": "^1.3.3",
|
|
27
28
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
|
28
29
|
"@stanlemon/eslint-config": "*",
|
|
29
30
|
"@testing-library/jest-dom": "^5.16.4",
|