Commit efb59da
module: preserve URL in the parent created by createRequire()
Previously, createRequire() does not preserve the URL it gets
passed in the mock parent module created, which can be
observable if it's used together with module.registerHooks().
This patch adds preservation of the URL if createRequire()
is invoked with one.
PR-URL: #60974
Fixes: #60973
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>1 parent 0b89e1e commit efb59da
4 files changed
Lines changed: 50 additions & 13 deletions
File tree
- lib/internal/modules/cjs
- test
- fixtures/module-hooks
- module-hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
1922 | 1922 | | |
1923 | 1923 | | |
1924 | 1924 | | |
1925 | | - | |
| 1925 | + | |
1926 | 1926 | | |
1927 | 1927 | | |
1928 | 1928 | | |
| |||
1934 | 1934 | | |
1935 | 1935 | | |
1936 | 1936 | | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
1937 | 1941 | | |
1938 | 1942 | | |
1939 | 1943 | | |
| |||
1944 | 1948 | | |
1945 | 1949 | | |
1946 | 1950 | | |
1947 | | - | |
| 1951 | + | |
1948 | 1952 | | |
1949 | 1953 | | |
1950 | 1954 | | |
1951 | 1955 | | |
1952 | | - | |
1953 | | - | |
| 1956 | + | |
| 1957 | + | |
1954 | 1958 | | |
1955 | | - | |
1956 | | - | |
| 1959 | + | |
| 1960 | + | |
1957 | 1961 | | |
1958 | | - | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
1959 | 1967 | | |
1960 | | - | |
| 1968 | + | |
1961 | 1969 | | |
1962 | 1970 | | |
1963 | | - | |
1964 | | - | |
| 1971 | + | |
| 1972 | + | |
1965 | 1973 | | |
1966 | | - | |
| 1974 | + | |
1967 | 1975 | | |
1968 | | - | |
| 1976 | + | |
1969 | 1977 | | |
1970 | 1978 | | |
1971 | 1979 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Whitespace-only changes.
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments