Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm:tmp-promise@3.0.3 doesn't work when use --trace-ops #2841

Closed
loynoir opened this issue Nov 5, 2022 · 2 comments
Closed

npm:tmp-promise@3.0.3 doesn't work when use --trace-ops #2841

loynoir opened this issue Nov 5, 2022 · 2 comments
Labels
bug Something isn't working needs triage

Comments

@loynoir
Copy link
Contributor

loynoir commented Nov 5, 2022

Describe the bug

npm:tmp-promise@3.0.3 doesn't work

Steps to Reproduce

reproduce.test.ts

import { file } from 'npm:tmp-promise@3.0.3'

Deno.test('foobar', async () => {
  const { path, cleanup } = await file()
  console.log(path)
  await cleanup()
})
$ deno test --trace-ops -A --unstable reproduce.test.ts 
running 1 test from ./reproduce.test.ts
foobar ...
Uncaught error from ./reproduce.test.ts FAILED
foobar ... cancelled (0ms)

 ERRORS 

./reproduce.test.ts (uncaught error)
error: NotFound: No such file or directory (os error 2), stat '/tmp/tmp-xxx-xxx'
This error was not caught from a test and caused the test runner to fail on the referenced module.
It most likely originated from a dangling promise, event/timeout handler or top-level code.

 FAILURES 

./reproduce.test.ts (uncaught error)

Expected behavior

No Error.

Environment

  • OS: [e.g. Ubuntu 20.04, MacOS 11]
  • deno version:
  • std version:
$ deno --version
deno 1.27.1 (release, x86_64-unknown-linux-gnu)
v8 10.8.168.4
typescript 4.8.3

Additional

I add --trace-ops because deno complain leak resource, seems like this issue is behind that issue.

@loynoir loynoir added bug Something isn't working needs triage labels Nov 5, 2022
@loynoir loynoir changed the title npm:tmp-promise@3.0.3 doesn't work npm:tmp-promise@3.0.3 doesn't work when use --trace-ops Nov 5, 2022
@dhardtke
Copy link

Same issue just using Deno.makeTempDir():

import { fs, path } from "../../../deps.ts";

Deno.test("My test", async (t) => {
    const tmpDir = await Deno.makeTempDir();
    const thumbnailDir = path.join(tmpDir, "subdir");
    await fs.ensureDir(thumbnailDir);
});

-->

./tests/issue.test.ts (uncaught error)
error: (in promise) NotFound: The system cannot find the file specified. (os error 2), stat 'C:\Users\user\AppData\Local\Temp\67c2eca6\subdir'
This error was not caught from a test and caused the test runner to fail on the referenced module.
It most likely originated from a dangling promise, event/timeout handler or top-level code.

dhardtke added a commit to dhardtke/prandium that referenced this issue Nov 13, 2022
@iuioiua
Copy link
Contributor

iuioiua commented Oct 4, 2023

Both code snippets in this issue now work (tested on macOS with Deno v1.37.1). @loynoir and @dhardtke, are you still encountering these issues? If not, we can close this issue.

@loynoir loynoir closed this as completed Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

3 participants