-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: updated ebadplatform messaging to be generated based on the error (
- Loading branch information
Showing
3 changed files
with
80 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,17 +241,37 @@ Object { | |
Array [ | ||
"notsup", | ||
String( | ||
Valid OS: !yours,mine | ||
Valid Arch: x867,x5309 | ||
Actual OS: posix | ||
Actual Arch: x64 | ||
Valid os: !yours,mine | ||
Actual os: posix | ||
Valid cpu: x867,x5309 | ||
Actual cpu: x64 | ||
), | ||
], | ||
], | ||
"summary": Array [ | ||
Array [ | ||
"notsup", | ||
"Unsupported platform for [email protected]: wanted {/"os/":/"!yours,mine/",/"arch/":/"x867,x5309/"} (current: {/"os/":/"posix/",/"arch/":/"x64/"})", | ||
"Unsupported platform for [email protected]: wanted {/"os/":/"!yours,mine/",/"cpu/":/"x867,x5309/"} (current: {/"os/":/"posix/",/"cpu/":/"x64/"})", | ||
], | ||
], | ||
} | ||
` | ||
|
||
exports[`test/lib/utils/error-message.js TAP bad platform omits keys with no required value > must match snapshot 1`] = ` | ||
Object { | ||
"detail": Array [ | ||
Array [ | ||
"notsup", | ||
String( | ||
Valid os: !yours,mine | ||
Actual os: posix | ||
), | ||
], | ||
], | ||
"summary": Array [ | ||
Array [ | ||
"notsup", | ||
"Unsupported platform for [email protected]: wanted {/"os/":/"!yours,mine/"} (current: {/"os/":/"posix/"})", | ||
], | ||
], | ||
} | ||
|
@@ -263,17 +283,17 @@ Object { | |
Array [ | ||
"notsup", | ||
String( | ||
Valid OS: !yours | ||
Valid Arch: x420 | ||
Actual OS: posix | ||
Actual Arch: x64 | ||
Valid os: !yours | ||
Actual os: posix | ||
Valid cpu: x420 | ||
Actual cpu: x64 | ||
), | ||
], | ||
], | ||
"summary": Array [ | ||
Array [ | ||
"notsup", | ||
"Unsupported platform for [email protected]: wanted {/"os/":/"!yours/",/"arch/":/"x420/"} (current: {/"os/":/"posix/",/"arch/":/"x64/"})", | ||
"Unsupported platform for [email protected]: wanted {/"os/":/"!yours/",/"cpu/":/"x420/"} (current: {/"os/":/"posix/",/"cpu/":/"x64/"})", | ||
], | ||
], | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -384,6 +384,27 @@ t.test('bad platform', async t => { | |
t.matchSnapshot(errorMessage(er)) | ||
t.end() | ||
}) | ||
t.test('omits keys with no required value', t => { | ||
const er = Object.assign(new Error('a bad plat'), { | ||
pkgid: '[email protected]', | ||
current: { | ||
os: 'posix', | ||
cpu: 'x64', | ||
libc: 'musl', | ||
}, | ||
required: { | ||
os: ['!yours', 'mine'], | ||
libc: [], // empty arrays should also lead to a key being removed | ||
cpu: undefined, // XXX npm-install-checks sets unused keys to undefined | ||
}, | ||
code: 'EBADPLATFORM', | ||
}) | ||
const msg = errorMessage(er) | ||
t.matchSnapshot(msg) | ||
t.notMatch(msg, /Valid cpu/, 'omits cpu from message') | ||
t.notMatch(msg, /Valid libc/, 'omits libc from message') | ||
t.end() | ||
}) | ||
}) | ||
|
||
t.test('explain ERESOLVE errors', async t => { | ||
|