UNPKG

e2ed

Version:

E2E testing framework over Playwright

20 lines (19 loc) 802 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRelativeTestFilePath = void 0; const node_path_1 = require("node:path"); const internal_1 = require("../constants/internal"); const error_1 = require("./error"); /** * Get the path to the test file relative to the project root directory, * from the absolute path to the test file. * @internal */ const getRelativeTestFilePath = (absoluteFilePath) => { const testFilePath = (0, node_path_1.relative)(internal_1.ABSOLUTE_PATH_TO_PROJECT_ROOT_DIRECTORY, absoluteFilePath); if (testFilePath.startsWith('.')) { throw new error_1.E2edError('Not a path to project file', { absoluteFilePath, testFilePath }); } return testFilePath; }; exports.getRelativeTestFilePath = getRelativeTestFilePath;