Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/utils/error-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ module.exports = (er, npm) => {

case 'EJSONPARSE':
// Check whether we ran into a conflict in our own package.json
if (er.file === resolve(npm.prefix, 'package.json')) {
if (er.path === resolve(npm.prefix, 'package.json')) {
const { isDiff } = require('parse-conflict-json')
const txt = require('fs').readFileSync(er.file, 'utf8')
const txt = require('fs').readFileSync(er.path, 'utf8')
.replace(/\r\n/g, '\n')
if (isDiff(txt)) {
detail.push([
Expand Down
6 changes: 3 additions & 3 deletions test/lib/utils/error-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ t.test('json parse', t => {
process.argv = ['arg', 'v']
t.matchSnapshot(errorMessage(Object.assign(new Error('conflicted'), {
code: 'EJSONPARSE',
file: resolve(dir, 'package.json'),
path: resolve(dir, 'package.json'),
}), npm))
t.end()
})
Expand All @@ -314,7 +314,7 @@ t.test('json parse', t => {
process.argv = ['arg', 'v']
t.matchSnapshot(errorMessage(Object.assign(new Error('not json'), {
code: 'EJSONPARSE',
file: resolve(dir, 'package.json'),
path: resolve(dir, 'package.json'),
}), npm))
t.end()
})
Expand All @@ -330,7 +330,7 @@ t.test('json parse', t => {
process.argv = ['arg', 'v']
t.matchSnapshot(errorMessage(Object.assign(new Error('not json'), {
code: 'EJSONPARSE',
file: `${dir}/blerg.json`,
path: `${dir}/blerg.json`,
}), npm))
t.end()
})
Expand Down