Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit04cfa52

Browse files
fix(bootstrap): preserve indentation style in package-lock.json when running bootstrap (#2955)
1 parent72d7af8 commit04cfa52

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

‎utils/npm-install/__tests__/npm-install.test.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const { npmInstall, npmInstallDependencies } = require("..");
2020
describe("npm-install",()=>{
2121
childProcess.exec.mockResolvedValue();
2222
fs.rename.mockResolvedValue();
23+
fs.copy.mockResolvedValue();
2324
writePkg.mockResolvedValue();
2425

2526
describe("npmInstall()",()=>{
@@ -141,7 +142,7 @@ describe("npm-install", () => {
141142

142143
awaitnpmInstallDependencies(pkg,dependencies,{});
143144

144-
expect(fs.rename).toHaveBeenLastCalledWith(pkg.manifestLocation,backupManifest);
145+
expect(fs.copy).toHaveBeenLastCalledWith(pkg.manifestLocation,backupManifest);
145146
expect(fs.renameSync).toHaveBeenLastCalledWith(backupManifest,pkg.manifestLocation);
146147
expect(writePkg).toHaveBeenLastCalledWith(pkg.manifestLocation,{
147148
name:"npm-install-deps",
@@ -463,19 +464,19 @@ describe("npm-install", () => {
463464
});
464465
});
465466

466-
it("rejects withrename error",async()=>{
467+
it("rejects withcopy error",async()=>{
467468
constpkg=newPackage(
468469
{
469-
name:"npm-install-deps-rename-error",
470+
name:"npm-install-deps-copy-error",
470471
version:"1.0.0",
471472
},
472-
path.normalize("/test/npm-install-deps/renameError")
473+
path.normalize("/test/npm-install-deps/copyError")
473474
);
474475
constdependencies=["I'm just here so we don't exit early"];
475476

476-
fs.rename.mockRejectedValueOnce(newError("Unable torename file"));
477+
fs.copy.mockRejectedValueOnce(newError("Unable tocopy file"));
477478

478-
awaitexpect(npmInstallDependencies(pkg,dependencies,{})).rejects.toThrow("Unable torename file");
479+
awaitexpect(npmInstallDependencies(pkg,dependencies,{})).rejects.toThrow("Unable tocopy file");
479480
});
480481

481482
it("cleans up synchronously after writeFile error",async()=>{

‎utils/npm-install/npm-install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function npmInstallDependencies(pkg, dependencies, config) {
6363

6464
log.silly("npmInstallDependencies","backup",pkg.manifestLocation);
6565

66-
returnfs.rename(pkg.manifestLocation,packageJsonBkp).then(()=>{
66+
returnfs.copy(pkg.manifestLocation,packageJsonBkp).then(()=>{
6767
constcleanup=()=>{
6868
log.silly("npmInstallDependencies","cleanup",pkg.manifestLocation);
6969
// Need to do this one synchronously because we might be doing it on exit.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp