Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint fixes
  • Loading branch information
awto committed Jan 16, 2025
commit cd26b450f5ae40b5a84cc48498271e4afcf24d65
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
'use strict';

import { mustCall } from '../common/index.mjs';
import assert from 'node:assert';
import { registerHooks } from 'node:module';
import { fileURL } from '../common/fixtures.mjs';
import { pathToFileURL } from "node:url";
import { sep as pathSep } from "node:path";

// This tests shows the url parameter in `load` can be changed in the `nextLoad` call
// It changes `foo` package name into `redirected-fs` and then loads `redirected-fs`
Expand All @@ -20,10 +16,7 @@ const hook = registerHooks({
},
load: mustCall(function load(url, context, nextLoad) {
assert.strictEqual(url, 'foo://bar');
return nextLoad(
fileURL('module-hooks', `redirected-fs.js`).href,
context
);
return nextLoad(fileURL('module-hooks', 'redirected-fs.js').href, context);
}),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ const hook = registerHooks({
resolve(specifier, context, nextResolve) {
assert.strictEqual(specifier, 'foo');
return {
url: "foo://bar",
url: 'foo://bar',
shortCircuit: true,
};
},
load: common.mustCall(function load(url, context, nextLoad) {
assert.strictEqual(url, "foo://bar",);
assert.strictEqual(url, 'foo://bar');
return nextLoad(
fixtures.fileURL('module-hooks', `redirected-fs.js`).href,
context,
fixtures.fileURL('module-hooks', 'redirected-fs.js').href,
context
);
}),
});
Expand Down