test: normalize client module fixture paths
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/** Node-half composition diagnostics for package metadata and built client bundles. */
|
/** Node-half composition diagnostics for package metadata and built client bundles. */
|
||||||
|
|
||||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
|
||||||
import { tmpdir } from 'node:os'
|
import { tmpdir } from 'node:os'
|
||||||
import { join } from 'node:path'
|
import { join } from 'node:path'
|
||||||
import { pathToFileURL } from 'node:url'
|
import { pathToFileURL } from 'node:url'
|
||||||
@@ -18,7 +18,7 @@ afterEach(() => {
|
|||||||
|
|
||||||
/** Create a resolvable dshClient package whose client export points at the returned path. */
|
/** Create a resolvable dshClient package whose client export points at the returned path. */
|
||||||
function writePackage(packageName: string): string {
|
function writePackage(packageName: string): string {
|
||||||
root ??= mkdtempSync(join(tmpdir(), 'dsh-client-modules-'))
|
root ??= realpathSync(mkdtempSync(join(tmpdir(), 'dsh-client-modules-')))
|
||||||
const pkgRoot = join(root, 'node_modules', ...packageName.split('/'))
|
const pkgRoot = join(root, 'node_modules', ...packageName.split('/'))
|
||||||
const clientPath = join(pkgRoot, 'lib', 'client.js')
|
const clientPath = join(pkgRoot, 'lib', 'client.js')
|
||||||
mkdirSync(pkgRoot, { recursive: true })
|
mkdirSync(pkgRoot, { recursive: true })
|
||||||
|
|||||||
Reference in New Issue
Block a user