Closed episage closed 4 years ago
Wait, what? Travis returned lint errors.
So how come my npm or yarn (below is clean master): ?
node:
➜ ow git:(master) node --version
v12.10.0
yarn cache clean
did NOT fix it. What is going on here? 🤔
Tests fail here as well.
➜ ow git:(custom_error_instance) yarn run ava
yarn run v1.21.0
$ /Users/epi/projects/foss/ow/node_modules/.bin/ava
6 tests failed
array › array.ofType
/Users/epi/projects/foss/ow/test/array.ts:159
158:
159: t.throws(() => {
160: ow(['foo', 'b'], ow.array.ofType(ow.string.minLength(3)));
Function threw unexpected exception:
ArgumentError {
message: '(array) Expected string `item` to have a minimum length of `3`, got `b`',
}
Expected message to equal:
'(array) Expected string to have a minimum length of `3`, got `b`'
Object.ow [as default] (source/index.ts:70:8)
test/array.ts:160:5
test/array.ts:159:4
set › set.ofType
/Users/epi/projects/foss/ow/test/set.ts:125
124:
125: t.throws(() => {
126: ow(new Set(['unicorn']), ow.set.ofType(ow.number));
Function threw unexpected exception:
ArgumentError {
message: '(Set) Expected `item` to be of type `number` but received type `string`',
}
Expected message to equal:
'(Set) Expected argument to be of type `number` but received type `string`'
Object.ow [as default] (source/index.ts:70:8)
test/set.ts:126:5
test/set.ts:125:4
object › object.valuesOfType
/Users/epi/projects/foss/ow/test/object.ts:74
73:
74: t.throws(() => {
75: ow({unicorn: '🦄', rainbow: 2}, ow.object.valuesOfType(ow.string));
Function threw unexpected exception:
ArgumentError {
message: '(object) Expected `item` to be of type `string` but received type `number`',
}
Expected message to equal:
'(object) Expected argument to be of type `string` but received type `number`'
Object.ow [as default] (source/index.ts:70:8)
test/object.ts:75:5
test/object.ts:74:4
object › object.valuesOfTypeDeep
/Users/epi/projects/foss/ow/test/object.ts:104
103:
104: t.throws(() => {
105: ow({unicorn: {key: '🦄', value: 1}}, ow.object.deepValuesOfType(ow.string));
Function threw unexpected exception:
ArgumentError {
message: '(object) Expected `object` to be of type `string` but received type `number`',
}
Expected message to equal:
'(object) Expected argument to be of type `string` but received type `number`'
Object.ow [as default] (source/index.ts:70:8)
test/object.ts:105:5
test/object.ts:104:4
map › map.keysOfType
/Users/epi/projects/foss/ow/test/map.ts:157
156:
157: t.throws(() => {
158: ow(new Map([['unicorn', '🦄']]), ow.map.keysOfType(ow.number));
Function threw unexpected exception:
ArgumentError {
message: '(Map) Expected `item` to be of type `number` but received type `string`',
}
Expected message to equal:
'(Map) Expected argument to be of type `number` but received type `string`'
Object.ow [as default] (source/index.ts:70:8)
test/map.ts:158:5
test/map.ts:157:4
map › map.valuesOfType
/Users/epi/projects/foss/ow/test/map.ts:179
178:
179: t.throws(() => {
180: ow(new Map([['unicorn', '🦄']]), ow.map.valuesOfType(ow.number));
Function threw unexpected exception:
ArgumentError {
message: '(Map) Expected `item` to be of type `number` but received type `string`',
}
Expected message to equal:
'(Map) Expected argument to be of type `number` but received type `string`'
Object.ow [as default] (source/index.ts:70:8)
test/map.ts:180:5
test/map.ts:179:4
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
➜ ow git:(custom_error_instance)
huh? I'm pretty sure I have a clean config. Should this be fixed?
I don’t want to ignore the todo warnings. They’re there to remind me to fix the todos.
@sindresorhus
How about assertion errors that make the tests fail?
NB nice puppy in your profile pic
Function threw unexpected exception:
ArgumentError {
message: '(object) Expected `item` to be of type `string` but received type `number`',
}
Expected message to equal:
'(object) Expected argument to be of type `string` but received type `number`'
Let me highlight the difference:
(object) Expected `item` to be of type `string` but received type `number`
vs
(object) Expected argument to be of type `string` but received type `number`
AKA item
vs argument
I think inferLabel
fn contains an error
Debugging these tests is a nightmare. test.only(..)
doesn't work?
line
in interLabel
resolves to:
__1.default(item, predicate);
, so no wonder it returns item
as error message param
This was fixed in master.
This PR removes ESLint warnings using
/* eslint-disable-next-line ... */
. The errors and warnings removed were explicitly created, thus there is no need to display them in linter report.