Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
Signed-off-by: Jaid <[email protected]>
  • Loading branch information
Jaid committed Jun 14, 2022
1 parent 45e91f3 commit eabce12
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import path from "node:path"

const indexModule = require(process.env.MAIN ? path.resolve(process.env.MAIN) : path.join(__dirname, "..", "src"))
import {fileURLToPath, pathToFileURL} from "node:url"

const dirName = path.dirname(fileURLToPath(import.meta.url))
const indexPath = process.env.MAIN ?? path.join(dirName, "..", "src", "index.js")

/**
* @type { import("../src") }
*/
const {default: readableMs} = indexModule
const {default: readableMs} = await import(pathToFileURL(indexPath))

it("should run", () => {
expect(readableMs(3021)).toBe("3s 21ms")
Expand Down

0 comments on commit eabce12

Please sign in to comment.