• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import Core from './core';
17
18const core = Core.getInstance();
19
20const describe = function (desc, func) {
21    return Reflect.has(core, 'describe') ? core.describe(desc, func) : (desc, func) => { };
22};
23const it = function (desc, filter, func) {
24    return Reflect.has(core, 'it') ? core.it(desc, filter, func) : (desc, filter, func) => { };
25};
26const beforeEach = function (func) {
27    return Reflect.has(core, 'beforeEach') ? core.beforeEach(func) : (func) => { };
28};
29const afterEach = function (func) {
30    return Reflect.has(core, 'afterEach') ? core.afterEach(func) : (func) => { };
31};
32const beforeAll = function (func) {
33    return Reflect.has(core, 'beforeAll') ? core.beforeAll(func) : (func) => { };
34};
35const afterAll = function (func) {
36    return Reflect.has(core, 'afterAll') ? core.afterAll(func) : (func) => { };
37};
38const expect = function (actualValue) {
39    return Reflect.has(core, 'expect') ? core.expect(actualValue) : (actualValue) => { };
40};
41
42export {
43    describe, it, beforeAll, beforeEach, afterEach, afterAll, expect
44};
45