UNPKG

@palmares/tests

Version:

This defines a default test framework testing stuff inside of the framework

231 lines (226 loc) 7.21 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/adapter/index.ts var adapter_exports = {}; __export(adapter_exports, { TestAdapter: () => TestAdapter }); module.exports = __toCommonJS(adapter_exports); // src/adapter/expect.ts var TestExpectAdapter = class { static { __name(this, "TestExpectAdapter"); } toBe(_value, _expected, _isNot, _customData) { throw new Error("Not implemented"); } toEqual(_value, _expected, _isNot, _customData) { throw new Error("Not implemented"); } toStrictEqual(_value, _expected, _isNot, _customData) { throw new Error("Not implemented"); } toBeDefined(_value, _isNot, _customData) { throw new Error("Not implemented"); } toBeInstanceOf(__value, _expected, _isNot, _customData) { throw new Error("Not implemented"); } toHaveBeenCalled(_value, _isNot, _customData) { throw new Error("Not implemented"); } // eslint-disable-next-line ts/require-await async toHaveBeenCalledTimes(_value, _isNot, _customData) { throw new Error("Not implemented"); } // eslint-disable-next-line ts/require-await async toHaveBeenCalledWith(_value, _args, _isNot, _customData) { throw new Error("Not implemented"); } // eslint-disable-next-line ts/require-await async toHaveReturned(_value, _isNot, _customData) { throw new Error("Not implemented"); } // eslint-disable-next-line ts/require-await async toHaveReturnedTimes(_value, _expected, _isNot, _customData) { throw new Error("Not implemented"); } }; // src/adapter/functions.ts var TestFunctionsAdapter = class { static { __name(this, "TestFunctionsAdapter"); } /** * Should run a callback inside a describe function from your test framework. * * @example * ```typescript * import { TestFunctionsAdapter } from '@palmares/tests'; * * export default class JestTestFunctionsAdapter extends TestFunctionsAdapter { * getDescribe(descriptionName: string, callback: () => void): void { * const describe = require('@jest/globals').describe; * describe(descriptionName, () => { * callback(); * }); * } * } * ``` * * @param descriptionName - The name of the description * @param callback - The callback that should be called inside the describe function */ getDescribe(_descriptionName, _callback, _customData) { throw new Error("Not implemented"); } /** * Should run a async callback function inside a `test` or `it` function from your test framework. * * @example * ```typescript * import { TestFunctionsAdapter } from '@palmares/tests'; * * export default class JestTestFunctionsAdapter extends TestFunctionsAdapter { * getTest(descriptionName: string, callback: () => Promise<void>): void { * const test = require('@jest/globals').test; * test(descriptionName, async () => { * await callback(); * }); * } * } * ``` * * @param testName - The name of the test * @param callback - The callback that should be called inside the test function */ getTest(_testName, _callback, _customData) { throw new Error("Not implemented"); } /** * Should run a callback inside a beforeEach function from your test framework. * * @example * ```typescript * import { TestFunctionsAdapter } from '@palmares/tests'; * * export default class JestTestFunctionsAdapter extends TestFunctionsAdapter { * getBeforeEach(callback: () => Promise<void>): void { * const beforeEach = require('@jest/globals').beforeEach; * beforeEach(async () => { * await callback(); * }); * } * } * ``` * * @param callback - The callback that should be called inside the beforeEach function */ getBeforeEach(_callback, _customData) { throw new Error("Not implemented"); } /** * Should run a callback inside a afterEach function from your test framework. * * @example * ```typescript * import { TestFunctionsAdapter } from '@palmares/tests'; * * export default class JestTestFunctionsAdapter extends TestFunctionsAdapter { * getAfterEach(callback: () => Promise<void>): void { * const afterEach = require('@jest/globals').afterEach; * afterEach(async () => { * await callback(); * }); * } * } * ``` * * @param callback - The callback that should be called inside the beforeEach function */ getAfterEach(_callback, _customData) { throw new Error("Not implemented"); } /** * Should run a callback inside a beforeAll function from your test framework. * * @example * ```typescript * import { TestFunctionsAdapter } from '@palmares/tests'; * * export default class JestTestFunctionsAdapter extends TestFunctionsAdapter { * getBeforeAll(callback: () => Promise<void>): void { * const beforeAll = require('@jest/globals').beforeAll; * beforeAll(async () => { * await callback(); * }); * } * } * ``` * * @param callback - The callback that should be called inside the beforeEach function */ getBeforeAll(_callback, _customData) { throw new Error("Not implemented"); } /** * Should run a callback inside an afterAll function from your test framework. * * @example * ```typescript * import { TestFunctionsAdapter } from '@palmares/tests'; * * export default class JestTestFunctionsAdapter extends TestFunctionsAdapter { * getAfterAll(callback: () => Promise<void>): void { * const afterAll = require('@jest/globals').afterAll; * afterAll(async () => { * await callback(); * }); * } * } * ``` * * @param callback - The callback that should be called inside the beforeEach function */ getAfterAll(_callback, _customData) { throw new Error("Not implemented"); } }; // src/adapter/index.ts var TestAdapter = class { static { __name(this, "TestAdapter"); } functions = new TestFunctionsAdapter(); expect = new TestExpectAdapter(); // eslint-disable-next-line ts/require-await async getCustomProps() { throw new Error("Not implemented"); } /** Should return */ // eslint-disable-next-line ts/require-await async run(_filesToRun, _globalSetupFunctionBody, _std) { throw new Error("Not implemented"); } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { TestAdapter });