From ad74061ea1738152404f65a6da8ea7d9075f1b78 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 10 Oct 2022 14:08:04 -0700 Subject: [PATCH] chore: match platform specific paths --- test/basic.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/basic.js b/test/basic.js index ad43bd5..044d71a 100644 --- a/test/basic.js +++ b/test/basic.js @@ -1,7 +1,12 @@ const t = require('tap') +const { basename, join, posix } = require('path') +const fs = require('fs') const rpj = require('../') +const joinValues = (obj) => + Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, join(...v.split(posix.sep))])) + t.test('errors for bad/missing data', async t => { t.test('raises an error for missing file', t => t.rejects(rpj(t.testdir() + '/package.json'), { code: 'ENOENT' })) @@ -12,7 +17,7 @@ t.test('errors for bad/missing data', async t => { }) + '/package.json'), { code: 'EJSONPARSE' })) }) -t.test('clean up bundleddddddDependencies', async t => { +t.test('clean up bundleDependencies', async t => { t.test('change name if bundleDependencies is not present', t => t.resolveMatch(rpj(t.testdir({ 'package.json': JSON.stringify({ bundledDependencies: [] }), @@ -275,8 +280,6 @@ t.test('strip _fields', async t => { }) t.test('load directories.bin', async t => { - const { basename } = require('path') - const fs = require('fs') const rpjMock = t.mock('../', { fs: { ...fs, @@ -331,12 +334,12 @@ t.test('load directories.bin', async t => { directories: { bin: 'bin', }, - bin: { + bin: joinValues({ foo: 'bin/foo', bar: 'bin/bar', a: 'bin/subdir/a', b: 'bin/subdir/b', suba: 'bin/subdir/sub/suba', - }, + }), }) })