@react-native-harness/runtime 1.0.0-alpha.2 → 1.0.0-alpha.21
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 +23 -4
- package/assets/harness-module-system.js +73 -0
- package/dist/bundler/bundle.d.ts.map +1 -1
- package/dist/bundler/bundle.js +7 -2
- package/dist/bundler/errors.d.ts +5 -0
- package/dist/bundler/errors.d.ts.map +1 -1
- package/dist/bundler/errors.js +11 -0
- package/dist/bundler/evaluate.d.ts.map +1 -1
- package/dist/bundler/evaluate.js +7 -7
- package/dist/bundler/factory.d.ts +3 -0
- package/dist/bundler/factory.d.ts.map +1 -0
- package/dist/bundler/factory.js +36 -0
- package/dist/bundler/index.d.ts +2 -1
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/bundler/types.d.ts +7 -0
- package/dist/bundler/types.d.ts.map +1 -0
- package/dist/bundler/types.js +1 -0
- package/dist/client/factory.d.ts.map +1 -1
- package/dist/client/factory.js +34 -6
- package/dist/client/getDeviceDescriptor.d.ts +1 -1
- package/dist/client/getDeviceDescriptor.d.ts.map +1 -1
- package/dist/client/getDeviceDescriptor.js +18 -6
- package/dist/client/getWSServer.d.ts.map +1 -1
- package/dist/client/getWSServer.js +2 -1
- package/dist/client/setup-files.d.ts +12 -0
- package/dist/client/setup-files.d.ts.map +1 -0
- package/dist/client/setup-files.js +60 -0
- package/dist/collector/functions.d.ts +1 -1
- package/dist/collector/functions.d.ts.map +1 -1
- package/dist/collector/functions.js +10 -2
- package/dist/collector/types.d.ts +1 -1
- package/dist/collector/types.d.ts.map +1 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -1
- package/dist/disableHMRWhenReady.d.ts +2 -0
- package/dist/disableHMRWhenReady.d.ts.map +1 -0
- package/dist/disableHMRWhenReady.js +20 -0
- package/dist/entry-point.d.ts +2 -0
- package/dist/entry-point.d.ts.map +1 -0
- package/dist/entry-point.js +4 -0
- package/dist/expect/index.d.ts.map +1 -1
- package/dist/expect/index.js +2 -0
- package/dist/expect/setup.js +2 -0
- package/dist/filtering/index.d.ts +2 -0
- package/dist/filtering/index.d.ts.map +1 -0
- package/dist/filtering/index.js +1 -0
- package/dist/filtering/testNameFilter.d.ts +12 -0
- package/dist/filtering/testNameFilter.d.ts.map +1 -0
- package/dist/filtering/testNameFilter.js +56 -0
- package/dist/globals.d.ts +6 -2
- package/dist/globals.d.ts.map +1 -1
- package/dist/globals.js +7 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/initialize.js +14 -6
- package/dist/jest-mock.d.ts +2 -0
- package/dist/jest-mock.d.ts.map +1 -0
- package/dist/jest-mock.js +25 -0
- package/dist/mocker/index.d.ts +1 -1
- package/dist/mocker/index.d.ts.map +1 -1
- package/dist/mocker/index.js +1 -1
- package/dist/mocker/registry.d.ts +2 -3
- package/dist/mocker/registry.d.ts.map +1 -1
- package/dist/mocker/registry.js +25 -16
- package/dist/namespace.d.ts +18 -0
- package/dist/namespace.d.ts.map +1 -0
- package/dist/namespace.js +19 -0
- package/dist/polyfills.d.ts +11 -0
- package/dist/polyfills.d.ts.map +1 -0
- package/dist/polyfills.js +13 -0
- package/dist/render/ErrorBoundary.d.ts +17 -0
- package/dist/render/ErrorBoundary.d.ts.map +1 -0
- package/dist/render/ErrorBoundary.js +73 -0
- package/dist/render/TestComponentOverlay.d.ts +3 -0
- package/dist/render/TestComponentOverlay.d.ts.map +1 -0
- package/dist/render/TestComponentOverlay.js +36 -0
- package/dist/render/cleanup.d.ts +2 -0
- package/dist/render/cleanup.d.ts.map +1 -0
- package/dist/render/cleanup.js +6 -0
- package/dist/render/index.d.ts +6 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +66 -0
- package/dist/render/setup.d.ts +2 -0
- package/dist/render/setup.d.ts.map +1 -0
- package/dist/render/setup.js +7 -0
- package/dist/render/types.d.ts +12 -0
- package/dist/render/types.d.ts.map +1 -0
- package/dist/render/types.js +1 -0
- package/dist/runner/errors.d.ts +4 -2
- package/dist/runner/errors.d.ts.map +1 -1
- package/dist/runner/errors.js +21 -3
- package/dist/runner/factory.d.ts.map +1 -1
- package/dist/runner/factory.js +6 -1
- package/dist/runner/runSuite.d.ts.map +1 -1
- package/dist/runner/runSuite.js +59 -7
- package/dist/symbolicate.d.ts +3 -0
- package/dist/symbolicate.d.ts.map +1 -0
- package/dist/symbolicate.js +19 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/ui/ReadyScreen.d.ts.map +1 -1
- package/dist/ui/ReadyScreen.js +3 -10
- package/dist/ui/WrongEnvironmentScreen.d.ts.map +1 -1
- package/dist/ui/WrongEnvironmentScreen.js +2 -10
- package/dist/ui/state.d.ts +14 -1
- package/dist/ui/state.d.ts.map +1 -1
- package/dist/ui/state.js +22 -0
- package/dist/utils/emitter.d.ts.map +1 -1
- package/dist/waitFor.d.ts +21 -0
- package/dist/waitFor.d.ts.map +1 -0
- package/dist/waitFor.js +137 -0
- package/eslint.config.mjs +1 -7
- package/package.json +22 -14
- package/src/__tests__/collector.test.ts +55 -55
- package/src/__tests__/error-handling.test.ts +34 -34
- package/src/__tests__/expect.test.ts +13 -5
- package/src/__tests__/initialize.test.ts +24 -0
- package/src/bundler/bundle.ts +9 -2
- package/src/bundler/errors.ts +11 -0
- package/src/bundler/evaluate.ts +9 -9
- package/src/bundler/factory.ts +43 -0
- package/src/bundler/index.ts +2 -1
- package/src/bundler/types.ts +7 -0
- package/src/client/factory.ts +53 -11
- package/src/client/getDeviceDescriptor.ts +29 -8
- package/src/client/getWSServer.ts +2 -1
- package/src/client/setup-files.ts +81 -0
- package/src/collector/functions.ts +18 -2
- package/src/collector/types.ts +4 -1
- package/src/constants.ts +0 -1
- package/src/disableHMRWhenReady.ts +27 -0
- package/src/entry-point.ts +8 -0
- package/src/expect/index.ts +8 -2
- package/src/expect/setup.ts +3 -0
- package/src/filtering/index.ts +4 -0
- package/src/filtering/testNameFilter.ts +82 -0
- package/src/globals.ts +15 -2
- package/src/index.ts +4 -0
- package/src/initialize.ts +21 -8
- package/src/jest-mock.ts +32 -0
- package/src/mocker/index.ts +6 -1
- package/src/mocker/metro-require.d.ts +2 -0
- package/src/mocker/registry.ts +29 -18
- package/src/namespace.ts +41 -0
- package/src/polyfills.ts +14 -0
- package/src/react-native.d.ts +35 -6
- package/src/render/ErrorBoundary.tsx +108 -0
- package/src/render/TestComponentOverlay.tsx +47 -0
- package/src/render/cleanup.ts +7 -0
- package/src/render/index.ts +96 -0
- package/src/render/setup.ts +8 -0
- package/src/render/types.ts +11 -0
- package/src/runner/errors.ts +35 -5
- package/src/runner/factory.ts +8 -1
- package/src/runner/runSuite.ts +70 -9
- package/src/symbolicate.ts +24 -0
- package/src/ui/ReadyScreen.tsx +2 -12
- package/src/ui/WrongEnvironmentScreen.tsx +1 -19
- package/src/ui/state.ts +39 -0
- package/src/utils/emitter.ts +1 -0
- package/src/waitFor.ts +199 -0
- package/tsconfig.spec.json +7 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/assets/logo.png +0 -0
- package/assets/moduleSystem.flow.js +0 -1062
- package/types/global.d.ts +0 -2
- package/types/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
### Test Runtime for React Native Harness
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[![mit licence][license-badge]][license]
|
|
6
|
+
[![npm downloads][npm-downloads-badge]][npm-downloads]
|
|
7
|
+
[![Chat][chat-badge]][chat]
|
|
8
|
+
[![PRs Welcome][prs-welcome-badge]][prs-welcome]
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
The core test runtime that executes on React Native devices, providing Jest-compatible APIs (describe, it, expect) and managing test collection, execution, and result reporting in native environments.
|
|
11
|
+
|
|
12
|
+
## Made with ❤️ at Callstack
|
|
13
|
+
|
|
14
|
+
`@react-native-harness/runtime` is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Callstack][callstack-readme-with-love] is a group of React and React Native geeks, contact us at [hello@callstack.com](mailto:hello@callstack.com) if you need any help with these or just want to say hi!
|
|
15
|
+
|
|
16
|
+
Like the project? ⚛️ [Join the team](https://callstack.com/careers/?utm_campaign=Senior_RN&utm_source=github&utm_medium=readme) who does amazing stuff for clients and drives React Native Open Source! 🔥
|
|
17
|
+
|
|
18
|
+
[callstack-readme-with-love]: https://callstack.com/?utm_source=github.com&utm_medium=referral&utm_campaign=react-native-harness&utm_term=readme-with-love
|
|
19
|
+
[license-badge]: https://img.shields.io/npm/l/@react-native-harness/runtime?style=for-the-badge
|
|
20
|
+
[license]: https://github.com/callstackincubator/react-native-harness/blob/main/LICENSE
|
|
21
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dm/@react-native-harness/runtime?style=for-the-badge
|
|
22
|
+
[npm-downloads]: https://www.npmjs.com/package/@react-native-harness/runtime
|
|
23
|
+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
|
|
24
|
+
[prs-welcome]: ../../CONTRIBUTING.md
|
|
25
|
+
[chat-badge]: https://img.shields.io/discord/426714625279524876.svg?style=for-the-badge
|
|
26
|
+
[chat]: https://discord.gg/xgGt7KAjxv
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
// This file is a polyfill that monkey-patches the Metro module system
|
|
5
|
+
// to allow capturing nested require calls.
|
|
6
|
+
|
|
7
|
+
(function (globalObject) {
|
|
8
|
+
const myRequire = function (id) {
|
|
9
|
+
return globalObject.__r(id);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const myImportDefault = function (id) {
|
|
13
|
+
return globalObject.__r.importDefault(id);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const myImportAll = function (id) {
|
|
17
|
+
return globalObject.__r.importAll(id);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Monkey-patch define
|
|
21
|
+
const originalDefine = globalObject.__d;
|
|
22
|
+
globalObject.__d = function (factory, moduleId, dependencyMap) {
|
|
23
|
+
const wrappedFactory = function (...args) {
|
|
24
|
+
// Standard Metro with import support (7 arguments)
|
|
25
|
+
// args: global, require, importDefault, importAll, module, exports, dependencyMap
|
|
26
|
+
const global = args[0];
|
|
27
|
+
const moduleObject = args[4];
|
|
28
|
+
const exports = args[5];
|
|
29
|
+
const depMap = args[6];
|
|
30
|
+
|
|
31
|
+
return factory(
|
|
32
|
+
global,
|
|
33
|
+
myRequire,
|
|
34
|
+
myImportDefault,
|
|
35
|
+
myImportAll,
|
|
36
|
+
moduleObject,
|
|
37
|
+
exports,
|
|
38
|
+
depMap
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Call the original define with the wrapped factory
|
|
43
|
+
return originalDefine.call(this, wrappedFactory, moduleId, dependencyMap);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
globalObject.__resetModule = function (moduleId) {
|
|
47
|
+
const module = globalObject.__r.getModules().get(moduleId);
|
|
48
|
+
|
|
49
|
+
if (!module) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.hasError = false;
|
|
54
|
+
module.error = undefined;
|
|
55
|
+
module.isInitialized = false;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
globalObject.__resetModules = function () {
|
|
59
|
+
const modules = globalObject.__r.getModules();
|
|
60
|
+
|
|
61
|
+
modules.forEach(function (mod, moduleId) {
|
|
62
|
+
globalObject.__resetModule(moduleId);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
})(
|
|
66
|
+
typeof globalThis !== 'undefined'
|
|
67
|
+
? globalThis
|
|
68
|
+
: typeof global !== 'undefined'
|
|
69
|
+
? global
|
|
70
|
+
: typeof window !== 'undefined'
|
|
71
|
+
? window
|
|
72
|
+
: this
|
|
73
|
+
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/bundler/bundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/bundler/bundle.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,WAAW,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,CAUlE,CAAC"}
|
package/dist/bundler/bundle.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { getDevServerUrl } from '../utils/dev-server.js';
|
|
3
|
+
import { BundlingFailedError } from './errors.js';
|
|
3
4
|
const getModuleUrl = (fileName) => {
|
|
4
5
|
const devServerUrl = getDevServerUrl();
|
|
5
6
|
const bundleName = fileName.split('.').slice(0, -1).join('.') + '.bundle';
|
|
@@ -7,10 +8,14 @@ const getModuleUrl = (fileName) => {
|
|
|
7
8
|
modulesOnly: 'true',
|
|
8
9
|
platform: Platform.OS,
|
|
9
10
|
});
|
|
10
|
-
return `${devServerUrl}
|
|
11
|
+
return `${devServerUrl}${bundleName}?${urlSearchParams.toString()}`;
|
|
11
12
|
};
|
|
12
13
|
export const fetchModule = async (fileName) => {
|
|
13
14
|
const url = getModuleUrl(fileName);
|
|
14
15
|
const response = await fetch(url);
|
|
15
|
-
|
|
16
|
+
const text = await response.text();
|
|
17
|
+
if (!response.ok) {
|
|
18
|
+
throw new BundlingFailedError(fileName, text);
|
|
19
|
+
}
|
|
20
|
+
return text;
|
|
16
21
|
};
|
package/dist/bundler/errors.d.ts
CHANGED
|
@@ -7,4 +7,9 @@ export declare class MalformedModuleError extends Error {
|
|
|
7
7
|
readonly reason: string;
|
|
8
8
|
constructor(modulePath: string, reason: string);
|
|
9
9
|
}
|
|
10
|
+
export declare class BundlingFailedError extends Error {
|
|
11
|
+
readonly modulePath: string;
|
|
12
|
+
readonly reason: string;
|
|
13
|
+
constructor(modulePath: string, reason: string);
|
|
14
|
+
}
|
|
10
15
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/bundler/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;aAChB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;aAE3B,UAAU,EAAE,MAAM;aAClB,MAAM,EAAE,MAAM;gBADd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM;CAKjC"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/bundler/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;aAChB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;aAE3B,UAAU,EAAE,MAAM;aAClB,MAAM,EAAE,MAAM;gBADd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM;CAKjC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;aAE1B,UAAU,EAAE,MAAM;aAClB,MAAM,EAAE,MAAM;gBADd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM;CAMjC"}
|
package/dist/bundler/errors.js
CHANGED
|
@@ -16,3 +16,14 @@ export class MalformedModuleError extends Error {
|
|
|
16
16
|
this.name = 'MalformedModuleError';
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
export class BundlingFailedError extends Error {
|
|
20
|
+
modulePath;
|
|
21
|
+
reason;
|
|
22
|
+
constructor(modulePath, reason) {
|
|
23
|
+
const reasonMessage = JSON.parse(reason).message ?? reason;
|
|
24
|
+
super(`Bundling of ${modulePath} failed with error:\n\n${reasonMessage}\n`);
|
|
25
|
+
this.modulePath = modulePath;
|
|
26
|
+
this.reason = reason;
|
|
27
|
+
this.name = 'BundlingFailedError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/bundler/evaluate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/bundler/evaluate.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,EAAE,YAAY,MAAM,KAAG,IAsBrE,CAAC"}
|
package/dist/bundler/evaluate.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { MalformedModuleError } from './errors.js';
|
|
2
|
-
import { EnvironmentError } from '../errors.js';
|
|
3
2
|
export const evaluateModule = (moduleJs, modulePath) => {
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
3
|
+
const __rMatches = Array.from(moduleJs.matchAll(/__r\((\d+)\)/g));
|
|
4
|
+
if (__rMatches.length === 0) {
|
|
6
5
|
throw new MalformedModuleError(modulePath, 'No __r function found');
|
|
7
6
|
}
|
|
7
|
+
// Get the last match as there may be many require calls
|
|
8
|
+
const __rMatch = __rMatches[__rMatches.length - 1];
|
|
8
9
|
const __rParam = __rMatch[1];
|
|
9
10
|
if (!__rParam) {
|
|
10
11
|
throw new MalformedModuleError(modulePath, 'No __r parameter found');
|
|
11
12
|
}
|
|
13
|
+
const moduleId = Number(__rParam);
|
|
14
|
+
// This is important as if module was already initialized, it would not be re-initialized
|
|
15
|
+
global.__resetModule(moduleId);
|
|
12
16
|
// eslint-disable-next-line no-eval
|
|
13
17
|
eval(moduleJs);
|
|
14
|
-
if (!__r) {
|
|
15
|
-
throw new EnvironmentError('module evaluation', '__r is not defined');
|
|
16
|
-
}
|
|
17
|
-
__r(Number(__rParam));
|
|
18
18
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/bundler/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,eAAO,MAAM,UAAU,QAAO,OAoC7B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getEmitter } from '../utils/emitter.js';
|
|
2
|
+
import { fetchModule } from './bundle.js';
|
|
3
|
+
import { BundlingFailedError } from './errors.js';
|
|
4
|
+
export const getBundler = () => {
|
|
5
|
+
const events = getEmitter();
|
|
6
|
+
return {
|
|
7
|
+
events,
|
|
8
|
+
getModule: async (filePath) => {
|
|
9
|
+
const bundlingStartTime = Date.now();
|
|
10
|
+
events.emit({
|
|
11
|
+
type: 'module-bundling-started',
|
|
12
|
+
file: filePath,
|
|
13
|
+
});
|
|
14
|
+
try {
|
|
15
|
+
const moduleJs = await fetchModule(filePath);
|
|
16
|
+
events.emit({
|
|
17
|
+
type: 'module-bundling-finished',
|
|
18
|
+
file: filePath,
|
|
19
|
+
duration: Date.now() - bundlingStartTime,
|
|
20
|
+
});
|
|
21
|
+
return moduleJs;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
events.emit({
|
|
25
|
+
type: 'module-bundling-failed',
|
|
26
|
+
file: filePath,
|
|
27
|
+
duration: Date.now() - bundlingStartTime,
|
|
28
|
+
error: error instanceof BundlingFailedError
|
|
29
|
+
? error.reason
|
|
30
|
+
: 'Unknown error',
|
|
31
|
+
});
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
};
|
package/dist/bundler/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/bundler/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BundlerEvents } from '@react-native-harness/bridge';
|
|
2
|
+
import { EventEmitter } from '../utils/emitter.js';
|
|
3
|
+
export type Bundler = {
|
|
4
|
+
events: EventEmitter<BundlerEvents>;
|
|
5
|
+
getModule: (filePath: string) => Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bundler/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IACpC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAClD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/client/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/client/factory.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,SAAS,2EAgFrB,CAAC"}
|
package/dist/client/factory.js
CHANGED
|
@@ -4,14 +4,17 @@ import { getTestRunner } from '../runner/index.js';
|
|
|
4
4
|
import { getTestCollector } from '../collector/index.js';
|
|
5
5
|
import { combineEventEmitters } from '../utils/emitter.js';
|
|
6
6
|
import { getWSServer } from './getWSServer.js';
|
|
7
|
-
import {
|
|
7
|
+
import { getBundler, evaluateModule } from '../bundler/index.js';
|
|
8
|
+
import { markTestsAsSkippedByName } from '../filtering/index.js';
|
|
9
|
+
import { setup } from '../render/setup.js';
|
|
10
|
+
import { runSetupFiles } from './setup-files.js';
|
|
8
11
|
export const getClient = async () => {
|
|
9
12
|
const client = await getBridgeClient(getWSServer(), {
|
|
10
13
|
runTests: async () => {
|
|
11
14
|
throw new Error('Not implemented');
|
|
12
15
|
},
|
|
13
16
|
});
|
|
14
|
-
client.rpc.$functions.runTests = async (path) => {
|
|
17
|
+
client.rpc.$functions.runTests = async (path, options = {}) => {
|
|
15
18
|
if (store.getState().status === 'running') {
|
|
16
19
|
throw new Error('Already running tests');
|
|
17
20
|
}
|
|
@@ -19,16 +22,41 @@ export const getClient = async () => {
|
|
|
19
22
|
let collector = null;
|
|
20
23
|
let runner = null;
|
|
21
24
|
let events = null;
|
|
25
|
+
let bundler = null;
|
|
22
26
|
try {
|
|
23
27
|
collector = getTestCollector();
|
|
24
28
|
runner = getTestRunner();
|
|
25
|
-
|
|
29
|
+
bundler = getBundler();
|
|
30
|
+
events = combineEventEmitters(collector.events, runner.events, bundler.events);
|
|
26
31
|
events.addListener((event) => {
|
|
27
32
|
client.rpc.emitEvent(event.type, event);
|
|
28
33
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
await runSetupFiles({
|
|
35
|
+
setupFiles: options.setupFiles ?? [],
|
|
36
|
+
setupFilesAfterEnv: [],
|
|
37
|
+
events: events,
|
|
38
|
+
bundler: bundler,
|
|
39
|
+
evaluateModule,
|
|
40
|
+
});
|
|
41
|
+
const moduleJs = await bundler.getModule(path);
|
|
42
|
+
const collectionResult = await collector.collect(async () => {
|
|
43
|
+
await runSetupFiles({
|
|
44
|
+
setupFiles: [],
|
|
45
|
+
setupFilesAfterEnv: options.setupFilesAfterEnv ?? [],
|
|
46
|
+
events: events,
|
|
47
|
+
bundler: bundler,
|
|
48
|
+
evaluateModule,
|
|
49
|
+
});
|
|
50
|
+
// Setup automatic cleanup for rendered components
|
|
51
|
+
setup();
|
|
52
|
+
evaluateModule(moduleJs, path);
|
|
53
|
+
}, path);
|
|
54
|
+
// Apply test name pattern by marking non-matching tests as skipped
|
|
55
|
+
const processedTestSuite = options.testNamePattern
|
|
56
|
+
? markTestsAsSkippedByName(collectionResult.testSuite, options.testNamePattern)
|
|
57
|
+
: collectionResult.testSuite;
|
|
58
|
+
const result = await runner.run(processedTestSuite, path);
|
|
59
|
+
return result;
|
|
32
60
|
}
|
|
33
61
|
finally {
|
|
34
62
|
collector?.dispose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDeviceDescriptor.d.ts","sourceRoot":"","sources":["../../src/client/getDeviceDescriptor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDeviceDescriptor.d.ts","sourceRoot":"","sources":["../../src/client/getDeviceDescriptor.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,gBA+BtC,CAAC"}
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
+
const getPlatform = () => {
|
|
3
|
+
return Platform;
|
|
4
|
+
};
|
|
2
5
|
export const getDeviceDescriptor = () => {
|
|
3
|
-
|
|
6
|
+
const platform = getPlatform();
|
|
7
|
+
if (platform.OS === 'ios') {
|
|
4
8
|
return {
|
|
5
9
|
platform: 'ios',
|
|
6
10
|
manufacturer: 'Apple',
|
|
7
11
|
model: 'Unknown',
|
|
8
|
-
osVersion:
|
|
12
|
+
osVersion: platform.constants.osVersion,
|
|
9
13
|
};
|
|
10
14
|
}
|
|
11
|
-
if (
|
|
15
|
+
if (platform.OS === 'android') {
|
|
12
16
|
return {
|
|
13
17
|
platform: 'android',
|
|
14
|
-
manufacturer:
|
|
15
|
-
model:
|
|
16
|
-
osVersion:
|
|
18
|
+
manufacturer: platform.constants.Manufacturer,
|
|
19
|
+
model: platform.constants.Model,
|
|
20
|
+
osVersion: platform.constants.Release,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (platform.OS === 'kepler') {
|
|
24
|
+
return {
|
|
25
|
+
platform: 'vega',
|
|
26
|
+
manufacturer: '',
|
|
27
|
+
model: '',
|
|
28
|
+
osVersion: '',
|
|
17
29
|
};
|
|
18
30
|
}
|
|
19
31
|
throw new Error('Unsupported platform');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWSServer.d.ts","sourceRoot":"","sources":["../../src/client/getWSServer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAAO,
|
|
1
|
+
{"version":3,"file":"getWSServer.d.ts","sourceRoot":"","sources":["../../src/client/getWSServer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAAO,MAM9B,CAAC"}
|
|
@@ -3,5 +3,6 @@ import { WS_SERVER_PORT } from '../constants.js';
|
|
|
3
3
|
export const getWSServer = () => {
|
|
4
4
|
const devServerUrl = getDevServerUrl();
|
|
5
5
|
const hostname = devServerUrl.split('://')[1].split(':')[0];
|
|
6
|
-
|
|
6
|
+
const port = global.RN_HARNESS?.webSocketPort || WS_SERVER_PORT;
|
|
7
|
+
return `ws://${hostname}:${port}`;
|
|
7
8
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventEmitter } from '../utils/emitter.js';
|
|
2
|
+
import { Bundler } from '../bundler/index.js';
|
|
3
|
+
import { BundlerEvents } from '@react-native-harness/bridge';
|
|
4
|
+
export type RunSetupFilesOptions = {
|
|
5
|
+
setupFiles: string[];
|
|
6
|
+
setupFilesAfterEnv: string[];
|
|
7
|
+
events: EventEmitter<BundlerEvents>;
|
|
8
|
+
bundler: Bundler;
|
|
9
|
+
evaluateModule: (moduleJs: string, filePath: string) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const runSetupFiles: ({ setupFiles, setupFilesAfterEnv, events, bundler, evaluateModule, }: RunSetupFilesOptions) => Promise<void>;
|
|
12
|
+
//# sourceMappingURL=setup-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-files.d.ts","sourceRoot":"","sources":["../../src/client/setup-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,sEAMjC,oBAAoB,kBA8DtB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const runSetupFiles = async ({ setupFiles, setupFilesAfterEnv, events, bundler, evaluateModule, }) => {
|
|
2
|
+
for (const setupFile of setupFiles) {
|
|
3
|
+
const startTime = Date.now();
|
|
4
|
+
events.emit({
|
|
5
|
+
type: 'setup-file-bundling-started',
|
|
6
|
+
file: setupFile,
|
|
7
|
+
setupType: 'setupFiles',
|
|
8
|
+
});
|
|
9
|
+
try {
|
|
10
|
+
const setupModuleJs = await bundler.getModule(setupFile);
|
|
11
|
+
events.emit({
|
|
12
|
+
type: 'setup-file-bundling-finished',
|
|
13
|
+
file: setupFile,
|
|
14
|
+
setupType: 'setupFiles',
|
|
15
|
+
duration: Date.now() - startTime,
|
|
16
|
+
});
|
|
17
|
+
evaluateModule(setupModuleJs, setupFile);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
21
|
+
events.emit({
|
|
22
|
+
type: 'setup-file-bundling-failed',
|
|
23
|
+
file: setupFile,
|
|
24
|
+
setupType: 'setupFiles',
|
|
25
|
+
duration: Date.now() - startTime,
|
|
26
|
+
error: errorMessage,
|
|
27
|
+
});
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
for (const setupFile of setupFilesAfterEnv) {
|
|
32
|
+
const startTime = Date.now();
|
|
33
|
+
events.emit({
|
|
34
|
+
type: 'setup-file-bundling-started',
|
|
35
|
+
file: setupFile,
|
|
36
|
+
setupType: 'setupFilesAfterEnv',
|
|
37
|
+
});
|
|
38
|
+
try {
|
|
39
|
+
const setupModuleJs = await bundler.getModule(setupFile);
|
|
40
|
+
events.emit({
|
|
41
|
+
type: 'setup-file-bundling-finished',
|
|
42
|
+
file: setupFile,
|
|
43
|
+
setupType: 'setupFilesAfterEnv',
|
|
44
|
+
duration: Date.now() - startTime,
|
|
45
|
+
});
|
|
46
|
+
evaluateModule(setupModuleJs, setupFile);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
50
|
+
events.emit({
|
|
51
|
+
type: 'setup-file-bundling-failed',
|
|
52
|
+
file: setupFile,
|
|
53
|
+
setupType: 'setupFilesAfterEnv',
|
|
54
|
+
duration: Date.now() - startTime,
|
|
55
|
+
error: errorMessage,
|
|
56
|
+
});
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
@@ -18,5 +18,5 @@ export declare function beforeAll(fn: TestFn): void;
|
|
|
18
18
|
export declare function afterAll(fn: TestFn): void;
|
|
19
19
|
export declare function beforeEach(fn: TestFn): void;
|
|
20
20
|
export declare function afterEach(fn: TestFn): void;
|
|
21
|
-
export declare const collectTests: (fn: () => void) => CollectionResult
|
|
21
|
+
export declare const collectTests: (fn: () => void | Promise<void>) => Promise<CollectionResult>;
|
|
22
22
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/collector/functions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/collector/functions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AA4LzC,eAAO,MAAM,QAAQ,UACZ,MAAM,MAAM,MAAM,IAAI;iBAsBd,MAAM,MAAM,MAAM,IAAI;iBAqBtB,MAAM,MAAM,MAAM,IAAI;CAsBtC,CAAC;AAEF,eAAO,MAAM,IAAI,UACR,MAAM,MAAM,MAAM;iBAaV,MAAM,MAAM,MAAM;iBAWlB,MAAM,MAAM,MAAM;iBAWlB,MAAM;CAiBtB,CAAC;AAEF,eAAO,MAAM,EAAE,UAtDN,MAAM,MAAM,MAAM;iBAaV,MAAM,MAAM,MAAM;iBAWlB,MAAM,MAAM,MAAM;iBAWlB,MAAM;CAmBD,CAAC;AAEvB,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,QAQnC;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,QAQlC;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,QAQpC;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,QAQnC;AAgBD,eAAO,MAAM,YAAY,GACvB,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAC7B,OAAO,CAAC,gBAAgB,CAiB1B,CAAC"}
|
|
@@ -17,6 +17,14 @@ const computeSuiteStatus = (suite, parentContext) => {
|
|
|
17
17
|
return 'skipped';
|
|
18
18
|
if (suite.options.only)
|
|
19
19
|
return 'active';
|
|
20
|
+
// Check if this suite has any focused content (tests or child suites)
|
|
21
|
+
const hasFocusedTests = suite.tests.some((test) => test.options.only);
|
|
22
|
+
const hasFocusedChildren = suite.suites.some((childSuite) => childSuite.options.only ||
|
|
23
|
+
childSuite.tests.some((test) => test.options.only));
|
|
24
|
+
// If this suite has focused content, it should be active
|
|
25
|
+
if (hasFocusedTests || hasFocusedChildren)
|
|
26
|
+
return 'active';
|
|
27
|
+
// If parent has focused children and this suite has no focused content, skip it
|
|
20
28
|
if (parentContext.hasFocusedChildren)
|
|
21
29
|
return 'skipped';
|
|
22
30
|
return 'active';
|
|
@@ -253,10 +261,10 @@ const countTests = (suite) => {
|
|
|
253
261
|
}
|
|
254
262
|
return count;
|
|
255
263
|
};
|
|
256
|
-
export const collectTests = (fn) => {
|
|
264
|
+
export const collectTests = async (fn) => {
|
|
257
265
|
currentContext = clearState();
|
|
258
266
|
try {
|
|
259
|
-
fn();
|
|
267
|
+
await fn();
|
|
260
268
|
// Convert raw structure to final structure using computation phase
|
|
261
269
|
const testSuite = convertRawTestSuiteToTestSuite(getRootSuite());
|
|
262
270
|
const totalTests = countTests(testSuite);
|
|
@@ -4,7 +4,7 @@ export type TestFn = () => void | Promise<void>;
|
|
|
4
4
|
export type TestCollectorEventsEmitter = EventEmitter<TestCollectorEvents>;
|
|
5
5
|
export type TestCollector = {
|
|
6
6
|
events: TestCollectorEventsEmitter;
|
|
7
|
-
collect: (fn: () => void
|
|
7
|
+
collect: (fn: () => void | Promise<void>, testFilePath: string) => Promise<CollectionResult>;
|
|
8
8
|
dispose: () => void;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/collector/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,MAAM,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEhD,MAAM,MAAM,0BAA0B,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAE3E,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/collector/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,MAAM,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEhD,MAAM,MAAM,0BAA0B,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAE3E,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,CACP,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC9B,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC"}
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,OAAO,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disableHMRWhenReady.d.ts","sourceRoot":"","sources":["../src/disableHMRWhenReady.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,IAAI,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,SAAK,iBAuBhB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function disableHMRWhenReady(disable, retriesLeft, retryDelay = 10) {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
function attempt(remaining) {
|
|
4
|
+
try {
|
|
5
|
+
disable();
|
|
6
|
+
resolve();
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
if (remaining > 0 &&
|
|
10
|
+
error instanceof Error &&
|
|
11
|
+
error.message.includes('Expected HMRClient.setup() call at startup.')) {
|
|
12
|
+
setTimeout(() => attempt(remaining - 1), retryDelay);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
reject(error);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
attempt(retriesLeft);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-point.d.ts","sourceRoot":"","sources":["../src/entry-point.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expect/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expect/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAS5E,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,YAAY,CAAC;AAEpB,wBAAgB,YAAY,IAAI,YAAY,CAqF3C;AAED,QAAA,MAAM,YAAY,EAAE,YAA6B,CAAC;AAQlD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,YAAY,IAAI,MAAM,EAAE,CAAC;AAExC,YAAY,EACV,SAAS,EACT,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,QAAQ,GACT,MAAM,gBAAgB,CAAC"}
|
package/dist/expect/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// This is adapted version of https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/integrations/chai/index.ts
|
|
2
|
+
// Credits to Vitest team for the original implementation.
|
|
1
3
|
import { addCustomEqualityTesters, ASYMMETRIC_MATCHERS_OBJECT, customMatchers, getState, GLOBAL_EXPECT, setState, } from '@vitest/expect';
|
|
2
4
|
import * as chai from 'chai';
|
|
3
5
|
// Setup additional matchers
|
package/dist/expect/setup.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// This is adapted version of https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/integrations/chai/setup.ts
|
|
2
|
+
// Credits to Vitest team for the original implementation.
|
|
1
3
|
import { JestAsymmetricMatchers, JestChaiExpect, JestExtend, } from '@vitest/expect';
|
|
2
4
|
import * as chai from 'chai';
|
|
3
5
|
chai.use(JestExtend);
|