Twenty-shared tests parses decorator (#15765)
## Introduction Since we've moved some class validator instances from twenty-server to twenty-shared tests are red because they do not know how to parse decorators declarations We've fixed this by explicitly installing `class-validator` in `twenty-shared` and configuring jest swc accordingly ## Twenty-server class validator patch I don't even know if that's something we need anymore Seems to be a patch either fixing or introducing credit card and phone number validation Would prefer discussing the need or not to either before merging this as it could introduce regression at runtime: - Centralize the patch to be consumed in both `twenty-server` and `twenty-shared` - Remove the patch We should also document every patch motivations we do as it's quite though to iterate over a such huge one
This commit is contained in:
@@ -86,7 +86,7 @@
|
||||
"cache-manager-redis-yet": "^4.1.2",
|
||||
"chalk": "4.1.2",
|
||||
"class-transformer": "0.5.1",
|
||||
"class-validator": "patch:class-validator@0.14.0#./patches/class-validator+0.14.0.patch",
|
||||
"class-validator": "0.14.0",
|
||||
"class-validator-jsonschema": "^5.0.2",
|
||||
"cloudflare": "^4.5.0",
|
||||
"connect-redis": "^7.1.1",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -9,8 +9,15 @@ const jestConfig = {
|
||||
'@swc/jest',
|
||||
{
|
||||
jsc: {
|
||||
parser: { syntax: 'typescript', tsx: true },
|
||||
transform: { react: { runtime: 'automatic' } },
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
tsx: true,
|
||||
decorators: true,
|
||||
},
|
||||
transform: {
|
||||
react: { runtime: 'automatic' },
|
||||
decoratorMetadata: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@sniptt/guards": "^0.2.0",
|
||||
"class-validator": "^0.14.0",
|
||||
"handlebars": "^4.7.8",
|
||||
"libphonenumber-js": "^1.10.26",
|
||||
"qs": "^6.11.2",
|
||||
|
||||
@@ -18,14 +18,6 @@ export const getStartUnitOfDateTime = (
|
||||
const firstDayOfTheWeekAsDateFNSNumber =
|
||||
getFirstDayOfTheWeekAsANumberForDateFNS(firstDayOfTheWeek);
|
||||
|
||||
console.log({
|
||||
firstDayOfTheWeek,
|
||||
firstDayOfTheWeekAsDateFNSNumber,
|
||||
startOfWekk: startOfWeek(dateTime, {
|
||||
weekStartsOn: firstDayOfTheWeekAsDateFNSNumber,
|
||||
}),
|
||||
});
|
||||
|
||||
return startOfWeek(dateTime, {
|
||||
weekStartsOn: firstDayOfTheWeekAsDateFNSNumber,
|
||||
});
|
||||
|
||||
@@ -25040,6 +25040,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/validator@npm:^13.11.8":
|
||||
version: 13.15.6
|
||||
resolution: "@types/validator@npm:13.15.6"
|
||||
checksum: 10c0/a7c1a0041180fa083bf5feb5aa751d415ceaf3635643dd116d0dc0db83d872ff7b5378f178176887474362fe7b93aa831bd7555d3763534cee898b84ff4d499f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/validator@npm:^13.7.10":
|
||||
version: 13.12.0
|
||||
resolution: "@types/validator@npm:13.12.0"
|
||||
@@ -30513,14 +30520,14 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"class-validator@patch:class-validator@0.14.0#./patches/class-validator+0.14.0.patch::locator=twenty-server%40workspace%3Apackages%2Ftwenty-server":
|
||||
version: 0.14.0
|
||||
resolution: "class-validator@patch:class-validator@npm%3A0.14.0#./patches/class-validator+0.14.0.patch::version=0.14.0&hash=053904&locator=twenty-server%40workspace%3Apackages%2Ftwenty-server"
|
||||
"class-validator@npm:^0.14.0":
|
||||
version: 0.14.2
|
||||
resolution: "class-validator@npm:0.14.2"
|
||||
dependencies:
|
||||
"@types/validator": "npm:^13.7.10"
|
||||
libphonenumber-js: "npm:^1.10.14"
|
||||
validator: "npm:^13.7.0"
|
||||
checksum: 10c0/d996aa04abefb737f07ec3f389f74c7ee6f3ec7f0ab13a8244f1bdc777cef827f3b2297789b4814b24440cf8fa936f5af0beee21f84b9ae413c7568b4c8e7407
|
||||
"@types/validator": "npm:^13.11.8"
|
||||
libphonenumber-js: "npm:^1.11.1"
|
||||
validator: "npm:^13.9.0"
|
||||
checksum: 10c0/5bb67389d38fa23d342dffdd8e2dcee8235e1906e59799df5b2050278a6d89292fcaa88167f0215e3ddd684f47dcd51b004efa7be32d8aded91ee06cb317b3b8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -42602,6 +42609,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"libphonenumber-js@npm:^1.11.1":
|
||||
version: 1.12.26
|
||||
resolution: "libphonenumber-js@npm:1.12.26"
|
||||
checksum: 10c0/20d79a32f4ec8d4d67d32897085cfd74a2a4c950b1ff1b6bedc35da37f2f369a8b0a8798d0e8a7b4b91ad8633ef6476320f52051af489fbe70e35e0271e39da9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"libqp@npm:2.1.1":
|
||||
version: 2.1.1
|
||||
resolution: "libqp@npm:2.1.1"
|
||||
@@ -55958,7 +55972,7 @@ __metadata:
|
||||
cache-manager-redis-yet: "npm:^4.1.2"
|
||||
chalk: "npm:4.1.2"
|
||||
class-transformer: "npm:0.5.1"
|
||||
class-validator: "patch:class-validator@0.14.0#./patches/class-validator+0.14.0.patch"
|
||||
class-validator: "npm:0.14.0"
|
||||
class-validator-jsonschema: "npm:^5.0.2"
|
||||
cloudflare: "npm:^4.5.0"
|
||||
connect-redis: "npm:^7.1.1"
|
||||
@@ -56063,6 +56077,7 @@ __metadata:
|
||||
"@types/babel__preset-env": "npm:^7"
|
||||
"@types/handlebars": "npm:^4.1.0"
|
||||
babel-plugin-module-resolver: "npm:^5.0.2"
|
||||
class-validator: "npm:^0.14.0"
|
||||
glob: "npm:^11.0.1"
|
||||
handlebars: "npm:^4.7.8"
|
||||
libphonenumber-js: "npm:^1.10.26"
|
||||
@@ -57801,6 +57816,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"validator@npm:^13.9.0":
|
||||
version: 13.15.23
|
||||
resolution: "validator@npm:13.15.23"
|
||||
checksum: 10c0/22a05ec6a98d48d2b6fb34d43ce854af61d15842362d142e64cfca0325d4d0c2d1051d9f9d3a0f741e58ea888f73a35baf7a2a810f5aed0f89183bd5040f0177
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"value-or-promise@npm:1.0.11":
|
||||
version: 1.0.11
|
||||
resolution: "value-or-promise@npm:1.0.11"
|
||||
|
||||
Reference in New Issue
Block a user