Open
Description
Hey Jarred hope you're doing well, I noticed a difference between node and bun logs, when running a .mjs file. The errors are not entirely logged.
Here is the file.
import * as yup from 'yup';
export const schema = yup.object({
money: yup.number().required(),
});
const input = {
money: 'fake',
};
const result = schema.validateSync(input);
console.log(result);
node
logs
node ./src/services/paperwork/validators/yup.mjs
/xxx/node_modules/yup/lib/util/createValidation.js:54
const error = new _ValidationError.default(_ValidationError.default.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name);
^
ValidationError: money must be a `number` type, but the final value was: `NaN` (cast from the value `"fake"`).
at Object.createError (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/util/createValidation.js:54:21)
at Object.test (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/schema.js:478:76)
at validate (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/util/createValidation.js:86:21)
at runTests (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/util/runTests.js:39:5)
at NumberSchema._validate (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/schema.js:246:27)
at NumberSchema.validate (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/schema.js:271:51)
at /Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/object.js:182:17
at runTests (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/util/runTests.js:39:5)
at /Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/object.js:199:29
at /Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/lib/util/runTests.js:17:5 {
value: { money: NaN },
path: 'money',
type: 'typeError',
errors: [
'money must be a `number` type, but the final value was: `NaN` (cast from the value `"fake"`).'
],
params: {
value: NaN,
originalValue: 'fake',
label: undefined,
path: 'money',
type: 'number'
},
inner: []
}
bun run
logs
bun ./src/services/paperwork/validators/yup.mjs
[0.74ms] ".env.local"
17 | static isError(err) {
18 | return err && err.name === 'ValidationError';
19 | }
20 |
21 | constructor(errorOrErrors, value, field, type) {
22 | super();
^
ValidationError: money must be a `number` type, but the final value was: `NaN` (cast from the value `"fake"`).
path: "money"
at new ValidationError (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/ValidationError.js:22:4)
at createError (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/util/createValidation.js:42:20)
at validate (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/util/createValidation.js:74:15)
at runTests (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/util/runTests.js:30:4)
at _validate (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/schema.js:228:4)
at /Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/object.js:160:10
at runTests (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/util/runTests.js:30:4)
at /Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/object.js:177:6
at /Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/util/runTests.js:8:4
at /Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/schema.js:237:6
at /Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/util/runTests.js:8:4
at finishTestRun (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/util/runTests.js:58:8)
at validate (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/util/createValidation.js:84:93)
at runTests (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/util/runTests.js:30:4)
at _validate (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/schema.js:228:4)
at _validate (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/object.js:139:4)
at validateSync (/Users/matteogauthier/xxx/xxx/frontend_client_app/node_modules/yup/es/schema.js:264:4)
at /Users/matteogauthier/xxx/xxx/frontend_client_app/src/services/paperwork/validators/yup.mjs:11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment