Skip to content

Commit

Permalink
chore: match platform specific paths
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Oct 10, 2022
1 parent 7843692 commit ad74061
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/basic.js
Original file line number Diff line number Diff line change
@@ -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' }))
Expand All @@ -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: [] }),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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',
},
}),
})
})

0 comments on commit ad74061

Please sign in to comment.