one
Version:
One is a new React Framework that makes Vite serve both native and web.
29 lines (27 loc) • 1.72 kB
JavaScript
;
var import_vitest = require("vitest");
var import_sourceInspectorPlugin = require("./sourceInspectorPlugin.native.js");
(0, import_vitest.describe)("sourceInspectorPlugin helpers", function () {
(0, import_vitest.describe)("getSourceInspectorPath", function () {
(0, import_vitest.it)("keeps project files relative to the current cwd", function () {
(0, import_vitest.expect)((0, import_sourceInspectorPlugin.getSourceInspectorPath)("/repo/packages/one/src/App.tsx", "/repo")).toBe("/packages/one/src/App.tsx");
});
(0, import_vitest.it)("does not strip matching path prefixes from files outside cwd", function () {
(0, import_vitest.expect)((0, import_sourceInspectorPlugin.getSourceInspectorPath)("/repo-other/packages/one/src/App.tsx", "/repo")).toBe("/repo-other/packages/one/src/App.tsx");
});
});
(0, import_vitest.describe)("resolveEditorFilePath", function () {
(0, import_vitest.it)("resolves project-relative source paths against cwd", function () {
var fileExists = function (filePath) {
return filePath === "/repo/packages/one/src/App.tsx";
};
(0, import_vitest.expect)((0, import_sourceInspectorPlugin.resolveEditorFilePath)("/packages/one/src/App.tsx", "/repo", fileExists)).toBe("/repo/packages/one/src/App.tsx");
});
(0, import_vitest.it)("preserves absolute source paths for files outside cwd", function () {
(0, import_vitest.expect)((0, import_sourceInspectorPlugin.resolveEditorFilePath)("/Users/n8/shared/ui/Button.tsx", "/repo/apps/site", function () {
return false;
})).toBe("/Users/n8/shared/ui/Button.tsx");
});
});
});
//# sourceMappingURL=sourceInspectorPlugin.test.native.js.map