Closed MrLoh closed 5 years ago
Sounds great! I've started a refactoring to TypeScript and redesigned it to support any validator, not just Yup but haven't completed that effort. Also added more tests. You are very welcome to fork and make a PR
Hi @MrLoh,
I've been adding a feature more features recently, however I'm suddenly having trouble running jest on individual files.
json-schema-to-yup/test/convert.test.js:6
describe("yup schema validation", () => {
^
ReferenceError: describe is not defined
I can see that the tests reference ../
which point to the package.json
which then point to the dist
files. If I change my tests to point to ../src
const { buildYup } = require("../src");
Then it breaks with
json-schema-to-yup/src/index.js:1
(function (exports, require, module, __filename, __dirname) { import * as yup from "yup";
^
SyntaxError: Unexpected token *
Looks like jest is not configured at all? perhaps I'm using jest wrong with respect to your reconfiguration to use babel. I had been switching to typescript in my refactoring branch.
https://github.com/kristianmandrup/schema-to-yup/commits/refactoring
Please advice. Thanks.
PS: Would also love if you could check out the latest changes in master.
Cheers!
I definitely ran tests with the setup I committed. You can run the compiler in watch mode with microbundle watch -f cjs
and then test the compiled version. Otherwise you will need babel-jest
https://jestjs.io/docs/en/getting-started#using-babel. The Babel config is declared directly in package.json for simplicity reasons.
I’ll definitely check out the changes once I get back to this, but probably not before April we have a deadline coming up.
Cool :) I think babel-jest is key. Not sure it is in the docs under testing? I'll try it out tonight... Cheers!
I’m building a project to auto generate cm/s forms from GraphQL Schemas, wanted to use Formik and than cake across this package and graphSchemaToJson. I have a basic form generator build and decided to rewrite graphSchemaToJson because I encountered too many issues with that library and didn’t like the design. I’m rewriting it to return actual JSON Schema, like this library expects normally. Once this is ready I can let you know, maybe it’s interesting for this lib too.
I haven’t dug very deep into this library yet but it seems much better build. However I need a browser version, so not having a compiled package makes this unusable for me.
Are you planing to provide a proper compiled version or what you accept a PR that provides a compiled version using microbundle. Otherwise I’d just fork the code from this lib into mine and provide a new package.