file-path.js
This file
Path
test/helpers/file-path.js
15 lines · 439 bytes · JavaScript
Last changed by
Fix deno node:process execPath compatibility (#1160)CJbefore adoptionf3a1bf3
History of this fileTake it
12345678910111213141516import path from 'node:path';import process from 'node:process';
export const getAbsolutePath = file => ({file});export const getRelativePath = filePath => ({file: path.relative('.', filePath)});// Defined as getter so call to toString is not cachedexport const getDenoNodePath = () => Object.freeze({ __proto__: String.prototype, toString() { return process.execPath; }, get length() { return this.toString().length; },});