Skip to content

Commit

Permalink
misc: Apply PR comments from #49206 (#49647)
Browse files Browse the repository at this point in the history
This PR applies suggestions from @jridgewell's review of
#49206
  • Loading branch information
alexkirsz committed May 11, 2023
1 parent 1a867bb commit 5781401
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ export async function changeFile(
replaceWith: string
) {
return new Promise((resolve, reject) => {
const id = unsafeUniqueId()
let id
while ((id = unsafeUniqueId())) {
if (!fileChangedResolvers.has(id)) break
}

fileChangedResolvers.set(id, { resolve, reject })

Expand Down
4 changes: 4 additions & 0 deletions packages/next-swc/crates/next-dev-tests/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ async fn run_test(resource: PathBuf) -> JsResult {
let package_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let tests_dir = package_root.join("tests");
let integration_tests_dir = tests_dir.join("integration");
// We run tests from a temporary directory because tests can modify files in the
// test directory when testing the file watcher/HMR, and we have no reliable way
// to ensure that we can restore the original state of the test directory after
// running the test.
let resource_temp: PathBuf = tests_dir.join("temp").join(
resource
.strip_prefix(integration_tests_dir)
Expand Down

0 comments on commit 5781401

Please sign in to comment.