1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 00:21:05 -05:00
denoland-deno/cli/tests
Marvin Hagemeister 8608105208
fix(node): duplicate node_module suffixes (#19222)
Noticed that we're checking more module paths than necessary. In
particular the module path array contains a couple of entries with a
duplicated `node_modules/node_modules` suffix.

```js
[
    // ... more entries before here, where some also contain duplicate suffixes
    "/Users/marvinhagemeister/dev/preact-render-to-string/node_modules/.deno/node_modules",
    "/Users/marvinhagemeister/dev/preact-render-to-string/node_modules/node_modules", // <-- duplicate suffix
    "/Users/marvinhagemeister/dev/preact-render-to-string/node_modules",
    "/Users/marvinhagemeister/dev/node_modules",
    "/Users/marvinhagemeister/node_modules",
    "/Users/node_modules",
    "/node_modules",
    "/node_modules"  // <-- duplicate entry
]
```

This was caused by a misunderstanding in how Rust's
[`Path::ends_with()`](https://doc.rust-lang.org/std/path/struct.Path.html#method.ends_with)
works. It's designed to match on whole path segments and the suffix
`/node_modules` is not that, except for the root entry. This meant that
our check for if the path already ended with `node_module` always
returned `false`. Removing the leading slash fixes that.

While we're at it, we can remove the last condition where we explicitly
added the root `/node_modules` entry since the while loop prior to that
takes care of it already.
2023-05-23 12:46:14 +02:00
..
integration feat: add support for globs in the config file and CLI arguments for files (#19102) 2023-05-23 03:39:59 +02:00
node_compat fix(ext/node): fix whatwg url formatting (#19146) 2023-05-17 14:51:51 +09:00
testdata feat: add support for globs in the config file and CLI arguments for files (#19102) 2023-05-23 03:39:59 +02:00
unit chore(cli): One Rust test per JS and Node unit test file (#19199) 2023-05-22 13:35:59 -06:00
unit_node fix(node): duplicate node_module suffixes (#19222) 2023-05-23 12:46:14 +02:00
integration_tests.rs tests: move integration tests to a single module (#17380) 2023-01-13 02:59:13 +01:00