Match-id-29274c466e8ff01f1547e591ff136f857514db5f

This commit is contained in:
* 2022-03-15 18:01:45 +08:00 committed by *
parent 2100ebcb57
commit 80690326c8
5 changed files with 18 additions and 13 deletions

View File

@ -58,15 +58,7 @@ module.exports = {
// globalTeardown: undefined,
// A set of global variables that need to be available in all test environments
globals: {
//'isDev': process.env.NODE_ENV === 'development',
'MessageChannel': function MessageChannel() {
this.port1 = {};
this.port2 = {
postMessage() {}
};
}
},
// globals: {},
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",
@ -127,7 +119,7 @@ module.exports = {
// runner: "jest-runner",
// The paths to modules that run some code to configure or set up the testing environment before each test
//setupFiles: [],
setupFiles: [require.resolve('./scripts/__tests__/jest/jestEnvironment.js')],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: [require.resolve('./scripts/__tests__/jest/jestSetting.js')],

View File

@ -6,7 +6,13 @@ import { act } from '../../jest/customMatcher';
import Text from '../../jest/Text';
describe('useEffect Hook Test', () => {
const { useEffect, useLayoutEffect, useState, memo, forwardRef } = React;
const {
useEffect,
useLayoutEffect,
useState,
memo,
forwardRef
} = React;
it('简单使用useEffect', () => {
const App = () => {

View File

@ -2,6 +2,7 @@
import * as React from '../../../../libs/horizon/src/external/Horizon';
import * as HorizonDOM from '../../../../libs/horizon/src/dom/DOMExternal';
import * as LogUtils from '../../jest/logUtils';
import { act } from '../../jest/customMatcher';
import Text from '../../jest/Text';
describe('useImperativeHandle Hook Test', () => {
@ -10,7 +11,8 @@ describe('useImperativeHandle Hook Test', () => {
useImperativeHandle,
forwardRef
} = React;
const { unmountComponentAtNode } = HorizonDOM;
it('测试useImperativeHandle', () => {
let App = (props, ref) => {

View File

@ -0,0 +1,6 @@
global.MessageChannel = function MessageChannel() {
this.port1 = {};
this.port2 = {
postMessage() { }
};
};

View File

@ -2,7 +2,6 @@ import { unmountComponentAtNode } from '../../../libs/horizon/src/dom/DOMExterna
import * as LogUtils from '../jest/logUtils';
global.isDev = process.env.NODE_ENV === 'development';
global.container = null;
global.beforeEach(() => {
LogUtils.clear();