1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-14 10:01:51 -05:00
denoland-deno/cli/tests/unit_node
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
..
_fs test(node/fs): add fs.Dir tests (#18463) 2023-03-28 23:58:40 +09:00
crypto chore(cli): One Rust test per JS and Node unit test file (#19199) 2023-05-22 13:35:59 -06:00
internal refactor(node/crypto): scrypt polyfill to rust (#18746) 2023-04-18 14:29:10 +02:00
testdata fix(node): support passing parent stdio streams (#19171) 2023-05-18 14:02:14 +02:00
_test_utils.ts test(ext/node): port _fs tests from std/node (#18262) 2023-03-20 01:10:39 +09:00
async_hooks_test.ts BREAKING(unstable): remove "Deno.serve(handler, options)" overload (#18759) 2023-04-26 14:54:03 +02:00
child_process_test.ts fix(node): support passing parent stdio streams (#19171) 2023-05-18 14:02:14 +02:00
fs_test.ts fix(ext/node): implement "ascii" encoding for node:fs writeFile() (#18097) 2023-03-16 12:16:03 +09:00
http_test.ts refactor: further work on node http client (#19211) 2023-05-23 03:03:10 +02:00
module_test.ts fix(node): duplicate node_module suffixes (#19222) 2023-05-23 12:46:14 +02:00
process_test.ts feat(test): print pending tests on sigint (#18246) 2023-03-25 21:32:11 +02:00
querystring_test.ts test(ext/node): add querystring_test.ts and readline_test.ts (#18256) 2023-03-19 19:49:11 +09:00
readline_test.ts fix(npm): process not defined in readline (#19184) 2023-05-18 15:42:27 -04:00
string_decoder_test.ts test(ext/node): add string_decoder_test.ts from std/node (#18473) 2023-03-29 18:32:29 +09:00
timers_test.ts test(ext/node): add timers_tests.ts from std/node (#18472) 2023-03-29 18:34:37 +09:00
tls_test.ts test(ext/node): add tls_test (#17871) 2023-02-23 12:27:29 +09:00
tty_test.ts test(ext/node): add tty_test and util_test (#17868) 2023-02-23 12:28:19 +09:00
util_test.ts Revert "refactor(ext/node): Use Deno.inspect (#17960)" (#18491) 2023-03-30 15:33:28 +00:00
v8_test.ts feat(ext/node): implement node:v8 (#17806) 2023-02-17 18:48:09 +05:30
worker_threads_test.ts chore: fix & update node compat config (#19106) 2023-05-13 14:49:11 +09:00