xref: /third_party/node/test/parallel/test-require-long-path.js (revision 1cb0ef41)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciif (!common.isWindows)
41cb0ef41Sopenharmony_ci  common.skip('this test is Windows-specific.');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciconst fs = require('fs');
71cb0ef41Sopenharmony_ciconst path = require('path');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci// Make a path that is more than 260 chars long.
121cb0ef41Sopenharmony_ciconst dirNameLen = Math.max(260 - tmpdir.path.length, 1);
131cb0ef41Sopenharmony_ciconst dirName = path.join(tmpdir.path, 'x'.repeat(dirNameLen));
141cb0ef41Sopenharmony_ciconst fullDirPath = path.resolve(dirName);
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciconst indexFile = path.join(fullDirPath, 'index.js');
171cb0ef41Sopenharmony_ciconst otherFile = path.join(fullDirPath, 'other.js');
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_citmpdir.refresh();
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_cifs.mkdirSync(fullDirPath);
221cb0ef41Sopenharmony_cifs.writeFileSync(indexFile, 'require("./other");');
231cb0ef41Sopenharmony_cifs.writeFileSync(otherFile, '');
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_cirequire(indexFile);
261cb0ef41Sopenharmony_cirequire(otherFile);
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_citmpdir.refresh();
29

Indexes created Thu Nov 07 10:32:03 CST 2024