Skip to content

Commit

Permalink
fix: tests broken on Deno 2.1 (#2776)
Browse files Browse the repository at this point in the history
Resolves #2771

Specifically the `init` test fails:
```
deno test -A ./init
```
Output:
```
error: No target files found.
----- output end -----
init - fmt, lint, and type check project ... FAILED (157ms)
init with tailwind - fmt, lint, and type check project ...
------- output -------
Task check deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx
error: No target files found.
----- output end -----
init with tailwind - fmt, lint, and type check project ... FAILED (136ms)
```

Seems to be a gitignore issue, and _probably_ relates to the new
features that ["lint an fmt respect
gitignore"](denoland/deno#26897):
- the gitignore file in the fresh project has `tmp-*`
- the tmp directory created by the init test matches that pattern:
`tmp-${hash}`
- changing the tmp directory to `tmp_${hash}` resolves the issue 😄
  • Loading branch information
bhb603 authored Dec 4, 2024
1 parent 6ee4551 commit d86dcd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion init/src/init_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { withChildProcessServer } from "../../tests/test_utils.tsx";

async function withTmpDir(fn: (dir: string) => void | Promise<void>) {
const hash = crypto.randomUUID().replaceAll(/-/g, "");
const dir = path.join(import.meta.dirname!, "..", "..", `tmp-${hash}`);
const dir = path.join(import.meta.dirname!, "..", "..", `tmp_${hash}`);
await Deno.mkdir(dir, { recursive: true });

try {
Expand Down

0 comments on commit d86dcd6

Please sign in to comment.