-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f504b7
commit 45f0dd0
Showing
4 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
// Flags: --expose-internals | ||
|
||
const common = require('../common'); | ||
if (!common.isWindows) { | ||
common.skip('this test is Windows-specific.'); | ||
} | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const tmpdir = require('../common/tmpdir'); | ||
|
||
// https://github.com/nodejs/node/issues/50753 | ||
// Make a path that is more than 260 chars long. | ||
// Module layout will be the following: | ||
// package.json | ||
// main | ||
// main.js | ||
|
||
const packageDirNameLen = Math.max(260 - tmpdir.path.length, 1); | ||
const packageDirName = tmpdir.resolve('x'.repeat(packageDirNameLen)); | ||
const packageDirPath = path.resolve(packageDirName); | ||
const packageJsonFilePath = path.join(packageDirPath, 'package.json'); | ||
const mainDirName = 'main'; | ||
const mainDirPath = path.resolve(packageDirPath, mainDirName); | ||
const mainJsFile = 'main.js'; | ||
const mainJsFilePath = path.resolve(mainDirPath, mainJsFile); | ||
|
||
tmpdir.refresh(); | ||
|
||
fs.mkdirSync(packageDirPath); | ||
fs.writeFileSync( | ||
packageJsonFilePath, | ||
`{"main":"${mainDirName}/${mainJsFile}"}` | ||
); | ||
fs.mkdirSync(mainDirPath); | ||
fs.writeFileSync(mainJsFilePath, 'console.log("hello world");'); | ||
|
||
require('internal/modules/run_main').executeUserEntryPoint(packageDirPath); | ||
|
||
tmpdir.refresh(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters