MCPcopy Index your code
hub / github.com/nodejs/node / transformProjectRoot

Function transformProjectRoot

test/common/assertSnapshot.js:127–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125// The project root path may contain unicode characters.
126const kProjectRoot = '<project-root>';
127function transformProjectRoot() {
128 const projectRoot = path.resolve(__dirname, '../..');
129 if (process.env.NODE_TEST_DIR) {
130 const testDir = realpathSync(process.env.NODE_TEST_DIR);
131 // On Jenkins CI, the test dir may be overridden by `NODE_TEST_DIR`.
132 return transform(
133 transformPath(projectRoot, kProjectRoot),
134 transformPath(testDir, `${kProjectRoot}/test`),
135 // TODO(legendecas): test-runner may print relative paths to the test relative to cwd.
136 // It will be better if we could distinguish them from the project root.
137 transformPath(path.relative(projectRoot, testDir), 'test'),
138 );
139 }
140 return transformPath(projectRoot, kProjectRoot);
141}
142
143// Replaces tmpdirs created by `test/common/tmpdir.js`.
144function transformTmpDir(str) {

Callers 1

assertSnapshot.jsFile · 0.85

Calls 4

transformPathFunction · 0.85
transformFunction · 0.70
realpathSyncFunction · 0.50
resolveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…