@vyriy/jest-config 0.8.12 → 0.8.14
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/README.md +2 -0
- package/index.js +9 -0
- package/package.json +1 -1
- package/setup.cjs +17 -0
package/README.md
CHANGED
|
@@ -70,6 +70,8 @@ Jest transformer, reporter, environment, and style proxy packages are resolved f
|
|
|
70
70
|
|
|
71
71
|
The transform ignore rules keep normal dependencies ignored but allow Vyriy packages and the ESM Markdown/unified ecosystem used by SSG and docs packages to pass through SWC.
|
|
72
72
|
|
|
73
|
+
JSDOM uses Node export conditions in this shared config so server-oriented packages, including the AWS SDK, resolve their Node builds during tests. A CommonJS setup file provides Node's `TextEncoder` and `TextDecoder` globals for dependencies that expect them at import time.
|
|
74
|
+
|
|
73
75
|
## Install
|
|
74
76
|
|
|
75
77
|
With npm:
|
package/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
2
3
|
const requireFromPackage = createRequire(import.meta.url);
|
|
3
4
|
const resolveDependency = (request) => requireFromPackage.resolve(request);
|
|
5
|
+
const resolvePackageFile = (path) => fileURLToPath(new URL(path, import.meta.url));
|
|
4
6
|
const transformEsmPackages = [
|
|
5
7
|
'@vyriy',
|
|
6
8
|
'bail',
|
|
@@ -115,7 +117,14 @@ const config = {
|
|
|
115
117
|
],
|
|
116
118
|
resetMocks: false,
|
|
117
119
|
restoreMocks: true,
|
|
120
|
+
setupFiles: [resolvePackageFile('./setup.cjs')],
|
|
118
121
|
testEnvironment: resolveDependency('jest-environment-jsdom'),
|
|
122
|
+
testEnvironmentOptions: {
|
|
123
|
+
customExportConditions: [
|
|
124
|
+
'node',
|
|
125
|
+
'node-addons',
|
|
126
|
+
],
|
|
127
|
+
},
|
|
119
128
|
testMatch: ['**/?(*.)+(spec|test).?([mc])[jt]s?(x)'],
|
|
120
129
|
testPathIgnorePatterns: [
|
|
121
130
|
'/node_modules/',
|
package/package.json
CHANGED
package/setup.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { TextDecoder, TextEncoder } = require('node:util');
|
|
2
|
+
|
|
3
|
+
if (!globalThis.TextDecoder) {
|
|
4
|
+
Object.defineProperty(globalThis, 'TextDecoder', {
|
|
5
|
+
configurable: true,
|
|
6
|
+
value: TextDecoder,
|
|
7
|
+
writable: true,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (!globalThis.TextEncoder) {
|
|
12
|
+
Object.defineProperty(globalThis, 'TextEncoder', {
|
|
13
|
+
configurable: true,
|
|
14
|
+
value: TextEncoder,
|
|
15
|
+
writable: true,
|
|
16
|
+
});
|
|
17
|
+
}
|