| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 10e7c3a commit d5a1153
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,20 +3,10 @@ | |||
| 3 | 3 | const common = require('../common'); | |
| 4 | 4 | const fixtures = require('../common/fixtures'); | |
| 5 | 5 | const assert = require('assert'); | |
| 6 | - const path = require('path'); | ||
| 7 | 6 | const fs = require('fs'); | |
| 8 | 7 | const os = require('os'); | |
| 9 | 8 | ||
| 10 | - function pathToFileURL(p) { | ||
| 11 | - if (!path.isAbsolute(p)) | ||
| 12 | - throw new Error('Path must be absolute'); | ||
| 13 | - if (common.isWindows && p.startsWith('\\\\')) | ||
| 14 | - p = p.slice(2); | ||
| 15 | - return new URL(`file://${p}`); | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | - const p = path.resolve(fixtures.fixturesDir, 'a.js'); | ||
| 19 | - const url = pathToFileURL(p); | ||
| 9 | + const url = fixtures.fileURL('a.js'); | ||
| 20 | 10 | ||
| 21 | 11 | assert(url instanceof URL); | |
| 22 | 12 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,12 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | require('../common'); | |
| 4 | + const fixtures = require('../common/fixtures'); | ||
| 4 | 5 | const assert = require('assert'); | |
| 5 | - const path = require('path'); | ||
| 6 | 6 | ||
| 7 | 7 | const { createRequire } = require('module'); | |
| 8 | 8 | ||
| 9 | - const p = path.resolve(__dirname, '..', 'fixtures', 'fake.js'); | ||
| 10 | - const u = new URL(`file://${p}`); | ||
| 9 | + const u = fixtures.fileURL('fake.js'); | ||
| 11 | 10 | ||
| 12 | 11 | const reqToo = createRequire(u); | |
| 13 | 12 | assert.deepStrictEqual(reqToo('./experimental'), { ofLife: 42 }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments