Skip to content

Commit

Permalink
πŸ”§ Fix jest for esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
torifat committed Nov 7, 2021
1 parent b74eb93 commit 0138499
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 48 deletions.
12 changes: 0 additions & 12 deletions jest.config.js

This file was deleted.

6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@changesets/cli": "^2.17.0",
"ajv": "^8.6.3",
"esbuild": "^0.13.12",
"esbuild-jest-transform": "^1.1.0",
"eslint": "^8.2.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.3",
Expand All @@ -67,6 +68,9 @@
"jest": {
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.js"
]
],
"transform": {
"^.+\\.js$": ["esbuild-jest-transform"]
}
}
}
26 changes: 13 additions & 13 deletions src/__tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ exports[`Main should output error with codeframe 1`] = `
"ENUM must be equal to one of the allowed values
(paragraph, codeBlock, blockquote)
[0m [90m 2 | [39m [32m\\"type\\"[39m[33m:[39m [32m\\"doc\\"[39m[33m,[39m[0m
[0m [90m 3 | [39m [32m\\"version\\"[39m[33m:[39m [35m1[39m[33m,[39m[0m
[0m[31m[1m>[22m[39m[90m 4 | [39m [32m\\"content\\"[39m[33m:[39m [{ [32m\\"type\\"[39m[33m:[39m [32m\\"paragarph\\"[39m }][0m
[0m [90m | [39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mparagraph[31m here?[22m[39m[0m
[0m [90m 5 | [39m}[0m
[0m [90m 6 | [39m[0m"
[0m [90m 2 |[39m [32m\\"type\\"[39m[33m:[39m [32m\\"doc\\"[39m[33m,[39m[0m
[0m [90m 3 |[39m [32m\\"version\\"[39m[33m:[39m [35m1[39m[33m,[39m[0m
[0m[31m[1m>[22m[39m[90m 4 |[39m [32m\\"content\\"[39m[33m:[39m [{ [32m\\"type\\"[39m[33m:[39m [32m\\"paragarph\\"[39m }][0m
[0m [90m |[39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mparagraph[31m here?[22m[39m[0m
[0m [90m 5 |[39m }[0m
[0m [90m 6 |[39m[0m"
`;
exports[`Main should output error with reconstructed codeframe 1`] = `
"ENUM must be equal to one of the allowed values
(paragraph, codeBlock, blockquote)
[0m [90m 4 | [39m [32m\\"content\\"[39m[33m:[39m [[0m
[0m [90m 5 | [39m {[0m
[0m[31m[1m>[22m[39m[90m 6 | [39m [32m\\"type\\"[39m[33m:[39m [32m\\"paragarph\\"[39m[0m
[0m [90m | [39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mparagraph[31m here?[22m[39m[0m
[0m [90m 7 | [39m }[0m
[0m [90m 8 | [39m ][0m
[0m [90m 9 | [39m}[0m"
[0m [90m 4 |[39m [32m\\"content\\"[39m[33m:[39m [[0m
[0m [90m 5 |[39m {[0m
[0m[31m[1m>[22m[39m[90m 6 |[39m [32m\\"type\\"[39m[33m:[39m [32m\\"paragarph\\"[39m[0m
[0m [90m |[39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mparagraph[31m here?[22m[39m[0m
[0m [90m 7 |[39m }[0m
[0m [90m 8 |[39m ][0m
[0m [90m 9 |[39m }[0m"
`;
36 changes: 18 additions & 18 deletions src/validation-errors/__tests__/__snapshots__/enum.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Array [
"ENUM should be equal to one of the allowed values",
"(foo, bar)
",
"[0m[31m[1m>[22m[39m[90m 1 | [39m[32m\\"baz\\"[39m[0m
[0m [90m | [39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mbar[31m here?[22m[39m[0m",
"[0m[31m[1m>[22m[39m[90m 1 |[39m [32m\\"baz\\"[39m[0m
[0m [90m |[39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mbar[31m here?[22m[39m[0m",
]
`;

Expand All @@ -15,8 +15,8 @@ Array [
"ENUM should be equal to one of the allowed values",
"(foo, bar)
",
"[0m[31m[1m>[22m[39m[90m 1 | [39m[32m\\"baz\\"[39m[0m
[0m [90m | [39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mbar[31m here?[22m[39m[0m",
"[0m[31m[1m>[22m[39m[90m 1 |[39m [32m\\"baz\\"[39m[0m
[0m [90m |[39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mbar[31m here?[22m[39m[0m",
]
`;

Expand All @@ -25,8 +25,8 @@ Array [
"ENUM should be equal to one of the allowed values",
"(one, two)
",
"[0m[31m[1m>[22m[39m[90m 1 | [39m[32m\\"baz\\"[39m[0m
[0m [90m | [39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Unexpected value, should be equal to one of the allowed values[22m[39m[0m",
"[0m[31m[1m>[22m[39m[90m 1 |[39m [32m\\"baz\\"[39m[0m
[0m [90m |[39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Unexpected value, should be equal to one of the allowed values[22m[39m[0m",
]
`;

Expand All @@ -35,10 +35,10 @@ Array [
"ENUM should be equal to one of the allowed values",
"(foo, bar)
",
"[0m [90m 1 | [39m{[0m
[0m[31m[1m>[22m[39m[90m 2 | [39m [32m\\"id\\"[39m[33m:[39m [32m\\"baz\\"[39m[0m
[0m [90m | [39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mbar[31m here?[22m[39m[0m
[0m [90m 3 | [39m}[0m",
"[0m [90m 1 |[39m {[0m
[0m[31m[1m>[22m[39m[90m 2 |[39m [32m\\"id\\"[39m[33m:[39m [32m\\"baz\\"[39m[0m
[0m [90m |[39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mbar[31m here?[22m[39m[0m
[0m [90m 3 |[39m }[0m",
]
`;
Expand All @@ -47,10 +47,10 @@ Array [
"ENUM should be equal to one of the allowed values",
"(foo, bar)
",
"[0m [90m 1 | [39m{[0m
[0m[31m[1m>[22m[39m[90m 2 | [39m [32m\\"id\\"[39m[33m:[39m [32m\\"baz\\"[39m[0m
[0m [90m | [39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mbar[31m here?[22m[39m[0m
[0m [90m 3 | [39m}[0m",
"[0m [90m 1 |[39m {[0m
[0m[31m[1m>[22m[39m[90m 2 |[39m [32m\\"id\\"[39m[33m:[39m [32m\\"baz\\"[39m[0m
[0m [90m |[39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Did you mean [95mbar[31m here?[22m[39m[0m
[0m [90m 3 |[39m }[0m",
]
`;
Expand All @@ -59,9 +59,9 @@ Array [
"ENUM should be equal to one of the allowed values",
"(one, two)
",
"[0m [90m 1 | [39m{[0m
[0m[31m[1m>[22m[39m[90m 2 | [39m [32m\\"id\\"[39m[33m:[39m [32m\\"baz\\"[39m[0m
[0m [90m | [39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Unexpected value, should be equal to one of the allowed values[22m[39m[0m
[0m [90m 3 | [39m}[0m",
"[0m [90m 1 |[39m {[0m
[0m[31m[1m>[22m[39m[90m 2 |[39m [32m\\"id\\"[39m[33m:[39m [32m\\"baz\\"[39m[0m
[0m [90m |[39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1mπŸ‘ˆπŸ½ Unexpected value, should be equal to one of the allowed values[22m[39m[0m
[0m [90m 3 |[39m }[0m",
]
`;
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ exports[`Required prints correctly for missing required prop 1`] = `
Array [
"REQUIRED should have required property 'id'
",
"[0m [90m 1 | [39m{[0m
[0m[31m[1m>[22m[39m[90m 2 | [39m [32m\\"nested\\"[39m[33m:[39m {}[0m
[0m [90m | [39m [31m[1m^[22m[39m [31m[1m☹️ [95mid[31m is missing here![22m[39m[0m
[0m [90m 3 | [39m}[0m",
"[0m [90m 1 |[39m {[0m
[0m[31m[1m>[22m[39m[90m 2 |[39m [32m\\"nested\\"[39m[33m:[39m {}[0m
[0m [90m |[39m [31m[1m^[22m[39m [31m[1m☹️ [95mid[31m is missing here![22m[39m[0m
[0m [90m 3 |[39m }[0m",
]
`;

0 comments on commit 0138499

Please sign in to comment.