Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fslib): fix copyPromise mkdir overwrite (#1674)
* fix(fslib): fix copyPromise mkdir overwrite * refactor: use pathUtils.dirname * chore: update pnp hook
- Loading branch information
1 parent
405af59
commit 5e237a3
Showing
7 changed files
with
94 additions
and
14 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,35 @@ | ||
releases: | ||
"@yarnpkg/cli": prerelease | ||
"@yarnpkg/core": patch | ||
"@yarnpkg/fslib": patch | ||
"@yarnpkg/pnp": patch | ||
|
||
declined: | ||
- "@yarnpkg/plugin-compat" | ||
- "@yarnpkg/plugin-constraints" | ||
- "@yarnpkg/plugin-dlx" | ||
- "@yarnpkg/plugin-essentials" | ||
- "@yarnpkg/plugin-exec" | ||
- "@yarnpkg/plugin-file" | ||
- "@yarnpkg/plugin-git" | ||
- "@yarnpkg/plugin-github" | ||
- "@yarnpkg/plugin-http" | ||
- "@yarnpkg/plugin-init" | ||
- "@yarnpkg/plugin-interactive-tools" | ||
- "@yarnpkg/plugin-link" | ||
- "@yarnpkg/plugin-node-modules" | ||
- "@yarnpkg/plugin-npm" | ||
- "@yarnpkg/plugin-npm-cli" | ||
- "@yarnpkg/plugin-pack" | ||
- "@yarnpkg/plugin-patch" | ||
- "@yarnpkg/plugin-pnp" | ||
- "@yarnpkg/plugin-stage" | ||
- "@yarnpkg/plugin-typescript" | ||
- "@yarnpkg/plugin-version" | ||
- "@yarnpkg/plugin-workspace-tools" | ||
- vscode-zipfs | ||
- "@yarnpkg/builder" | ||
- "@yarnpkg/doctor" | ||
- "@yarnpkg/json-proxy" | ||
- "@yarnpkg/pnpify" | ||
- "@yarnpkg/shell" |
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
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 @@ | ||
import {NodeFS} from '../sources/NodeFS'; | ||
import {xfs, PortablePath} from '../sources'; | ||
|
||
const nodeFs = new NodeFS(); | ||
|
||
describe(`NodeFS`, () => { | ||
describe(`copyPromise`, () => { | ||
it(`should support copying files`, async () => { | ||
const tmpdir = await xfs.mktempPromise(); | ||
|
||
const source = `${tmpdir}/foo` as PortablePath; | ||
const destination = `${tmpdir}/bar` as PortablePath; | ||
|
||
const sourceContent = `Hello World`; | ||
|
||
await nodeFs.writeFilePromise(source, sourceContent); | ||
|
||
await nodeFs.copyPromise(destination, source); | ||
|
||
await expect(nodeFs.readFilePromise(source, `utf8`)).resolves.toStrictEqual(sourceContent); | ||
await expect(nodeFs.readFilePromise(destination, `utf8`)).resolves.toStrictEqual(sourceContent); | ||
}); | ||
|
||
it(`should support copying files (overwrite)`, async () => { | ||
const tmpdir = await xfs.mktempPromise(); | ||
|
||
const source = `${tmpdir}/foo` as PortablePath; | ||
const destination = `${tmpdir}/bar` as PortablePath; | ||
|
||
const sourceContent = `Hello World`; | ||
const destinationContent = `Goodbye World`; | ||
|
||
await nodeFs.writeFilePromise(source, sourceContent); | ||
await nodeFs.writeFilePromise(destination, destinationContent); | ||
|
||
await nodeFs.copyPromise(destination, source); | ||
|
||
await expect(nodeFs.readFilePromise(source, `utf8`)).resolves.toStrictEqual(sourceContent); | ||
await expect(nodeFs.readFilePromise(destination, `utf8`)).resolves.toStrictEqual(sourceContent); | ||
}); | ||
}); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.