Skip to content

Commit

Permalink
Fix: Properly export module resolver (#34)
Browse files Browse the repository at this point in the history
* Fix: Properly export module resolver

* fix: Export `resolve` function directly

* Chore: Add tests

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* Export `ModuleResolver` instead

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* Use better test names

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
  • Loading branch information
Richienb and mdjermanovic committed Apr 30, 2021
1 parent 62ea4bd commit aa38ef4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -14,7 +14,7 @@ const {
} = require("./config-array-factory");

const { CascadingConfigArrayFactory } = require("./cascading-config-array-factory");
const { ModuleResolver } = require("./shared/relative-module-resolver");
const ModuleResolver = require("./shared/relative-module-resolver");
const { ConfigArray, getUsedExtractedConfigs } = require("./config-array");
const { ConfigDependency } = require("./config-array/config-dependency");
const { ExtractedConfig } = require("./config-array/extracted-config");
Expand Down
Empty file.
Empty file.
26 changes: 26 additions & 0 deletions tests/lib/shared/relative-module-resolver.js
@@ -0,0 +1,26 @@
/**
* @fileoverview Tests for relative module resolver.
*/
"use strict";

const {
Legacy: {
ModuleResolver
}
} = require("../../..");
const { assert } = require("chai");
const path = require("path");

describe("ModuleResolver", () => {
describe("resolve()", () => {
it("should correctly resolve a relative path", () => {
assert.strictEqual(
ModuleResolver.resolve(
"./file2.js",
path.resolve("./tests/fixtures/relative-module-resolver/file.js")
),
path.resolve("./tests/fixtures/relative-module-resolver/file2.js")
);
});
});
});

0 comments on commit aa38ef4

Please sign in to comment.