1
0
Fork 0
mirror of synced 2024-07-14 10:45:51 +12:00

Updating Jest to latest 29.5.0 and then fixing snapshots to work with this - also setting worker memory limits for Node 16.10+ - where a leak can occur.

This commit is contained in:
mike12345567 2023-03-21 19:52:06 +00:00
parent 82286d519f
commit 926ee18703
6 changed files with 557 additions and 1575 deletions

View file

@ -15,6 +15,7 @@
"debug": "yarn build && node --expose-gc --inspect=9222 dist/index.js",
"postbuild": "copyfiles -u 1 src/**/*.svelte dist/ && copyfiles -u 1 src/**/*.hbs dist/ && copyfiles -u 1 src/**/*.json dist/",
"test": "bash scripts/test.sh",
"test:memory": "jest --maxWorkers=2 --logHeapUsage --forceExit",
"test:watch": "jest --watch",
"predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client",
"build:docker": "yarn run predocker && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION",
@ -125,7 +126,7 @@
"@babel/core": "7.17.4",
"@babel/preset-env": "7.16.11",
"@budibase/standard-components": "^0.9.139",
"@jest/test-sequencer": "24.9.0",
"@jest/test-sequencer": "29.5.0",
"@swc/core": "^1.3.25",
"@swc/jest": "^0.2.24",
"@trendyol/jest-testcontainers": "^2.1.1",
@ -134,7 +135,7 @@
"@types/global-agent": "2.1.1",
"@types/google-spreadsheet": "3.1.5",
"@types/ioredis": "4.28.10",
"@types/jest": "27.5.1",
"@types/jest": "29.5.0",
"@types/koa": "2.13.4",
"@types/koa__router": "8.0.8",
"@types/lodash": "4.14.180",
@ -154,7 +155,7 @@
"eslint": "6.8.0",
"ioredis-mock": "7.2.0",
"is-wsl": "2.2.0",
"jest": "28.1.1",
"jest": "29.5.0",
"jest-openapi": "0.14.2",
"jest-serial-runner": "^1.2.1",
"nodemon": "2.0.15",
@ -166,7 +167,7 @@
"supertest": "6.2.2",
"swagger-jsdoc": "6.1.0",
"timekeeper": "2.2.0",
"ts-jest": "28.0.4",
"ts-jest": "29.0.5",
"ts-node": "10.8.1",
"tsconfig-paths": "4.0.0",
"typescript": "4.7.3",

View file

@ -3,10 +3,10 @@
if [[ -n $CI ]]
then
# --runInBand performs better in ci where resources are limited
echo "jest --coverage --runInBand"
jest --coverage --runInBand
echo "jest --coverage --runInBand --forceExit --workerIdleMemoryLimit=1000MB"
jest --coverage --runInBand --forceExit --workerIdleMemoryLimit=1000MB
else
# --maxWorkers performs better in development
echo "jest --coverage --maxWorkers=2"
jest --coverage --maxWorkers=2
fi
echo "jest --coverage --maxWorkers=2 --forceExit --workerIdleMemoryLimit=1000MB"
jest --coverage --maxWorkers=2 --forceExit --workerIdleMemoryLimit=1000MB
fi

View file

@ -1,48 +1,48 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`viewBuilder Calculate and filter creates a view with the calculation statistics and filter schema 1`] = `
Object {
{
"map": "function (doc) {
if ((doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && !(
doc[\\"myField\\"] === undefined ||
doc[\\"myField\\"] === null ||
doc[\\"myField\\"] === \\"\\" ||
(Array.isArray(doc[\\"myField\\"]) && doc[\\"myField\\"].length === 0)
)) && (doc[\\"age\\"] > 17)) {
emit(doc[\\"_id\\"], doc[\\"myField\\"]);
if ((doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" && !(
doc["myField"] === undefined ||
doc["myField"] === null ||
doc["myField"] === "" ||
(Array.isArray(doc["myField"]) && doc["myField"].length === 0)
)) && (doc["age"] > 17)) {
emit(doc["_id"], doc["myField"]);
}
}",
"meta": Object {
"meta": {
"calculation": "stats",
"field": "myField",
"filters": Array [
Object {
"filters": [
{
"condition": "MT",
"key": "age",
"value": 17,
},
],
"groupBy": undefined,
"schema": Object {
"avg": Object {
"schema": {
"avg": {
"type": "number",
},
"count": Object {
"count": {
"type": "number",
},
"field": Object {
"field": {
"type": "string",
},
"max": Object {
"max": {
"type": "number",
},
"min": Object {
"min": {
"type": "number",
},
"sum": Object {
"sum": {
"type": "number",
},
"sumsqr": Object {
"sumsqr": {
"type": "number",
},
},
@ -53,42 +53,42 @@ Object {
`;
exports[`viewBuilder Calculate creates a view with the calculation statistics schema 1`] = `
Object {
{
"map": "function (doc) {
if ((doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && !(
doc[\\"myField\\"] === undefined ||
doc[\\"myField\\"] === null ||
doc[\\"myField\\"] === \\"\\" ||
(Array.isArray(doc[\\"myField\\"]) && doc[\\"myField\\"].length === 0)
if ((doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" && !(
doc["myField"] === undefined ||
doc["myField"] === null ||
doc["myField"] === "" ||
(Array.isArray(doc["myField"]) && doc["myField"].length === 0)
)) ) {
emit(doc[\\"_id\\"], doc[\\"myField\\"]);
emit(doc["_id"], doc["myField"]);
}
}",
"meta": Object {
"meta": {
"calculation": "stats",
"field": "myField",
"filters": Array [],
"filters": [],
"groupBy": undefined,
"schema": Object {
"avg": Object {
"schema": {
"avg": {
"type": "number",
},
"count": Object {
"count": {
"type": "number",
},
"field": Object {
"field": {
"type": "string",
},
"max": Object {
"max": {
"type": "number",
},
"min": Object {
"min": {
"type": "number",
},
"sum": Object {
"sum": {
"type": "number",
},
"sumsqr": Object {
"sumsqr": {
"type": "number",
},
},
@ -99,22 +99,22 @@ Object {
`;
exports[`viewBuilder Filter creates a view with multiple filters and conjunctions 1`] = `
Object {
{
"map": "function (doc) {
if (doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && (doc[\\"Name\\"] === \\"Test\\" || doc[\\"Yes\\"] > \\"Value\\")) {
emit(doc[\\"_id\\"], doc[\\"undefined\\"]);
if (doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" && (doc["Name"] === "Test" || doc["Yes"] > "Value")) {
emit(doc["_id"], doc["undefined"]);
}
}",
"meta": Object {
"meta": {
"calculation": undefined,
"field": undefined,
"filters": Array [
Object {
"filters": [
{
"condition": "EQUALS",
"key": "Name",
"value": "Test",
},
Object {
{
"condition": "MT",
"conjunction": "OR",
"key": "Yes",
@ -129,16 +129,16 @@ Object {
`;
exports[`viewBuilder Group By creates a view emitting the group by field 1`] = `
Object {
{
"map": "function (doc) {
if (doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" ) {
emit(doc[\\"age\\"], doc[\\"score\\"]);
if (doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" ) {
emit(doc["age"], doc["score"]);
}
}",
"meta": Object {
"meta": {
"calculation": undefined,
"field": "score",
"filters": Array [],
"filters": [],
"groupBy": "age",
"schema": null,
"tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",

View file

@ -1,21 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`/datasources fetch returns all the datasources from the server 1`] = `
Array [
Object {
"config": Object {},
"entities": Array [
Object {
[
{
"config": {},
"entities": [
{
"_id": "ta_users",
"_rev": "1-2375e1bc58aeec664dc1b1f04ad43e44",
"createdAt": "2020-01-01T00:00:00.000Z",
"name": "Users",
"primaryDisplay": "email",
"schema": Object {
"email": Object {
"constraints": Object {
"schema": {
"email": {
"constraints": {
"email": true,
"length": Object {
"length": {
"maximum": "",
},
"presence": true,
@ -25,8 +25,8 @@ Array [
"name": "email",
"type": "string",
},
"firstName": Object {
"constraints": Object {
"firstName": {
"constraints": {
"presence": false,
"type": "string",
},
@ -34,8 +34,8 @@ Array [
"name": "firstName",
"type": "string",
},
"lastName": Object {
"constraints": Object {
"lastName": {
"constraints": {
"presence": false,
"type": "string",
},
@ -43,9 +43,9 @@ Array [
"name": "lastName",
"type": "string",
},
"roleId": Object {
"constraints": Object {
"inclusion": Array [
"roleId": {
"constraints": {
"inclusion": [
"ADMIN",
"POWER",
"BASIC",
@ -58,9 +58,9 @@ Array [
"name": "roleId",
"type": "options",
},
"status": Object {
"constraints": Object {
"inclusion": Array [
"status": {
"constraints": {
"inclusion": [
"active",
"inactive",
],
@ -74,15 +74,15 @@ Array [
},
"type": "table",
"updatedAt": "2020-01-01T00:00:00.000Z",
"views": Object {},
"views": {},
},
],
"name": "Budibase DB",
"source": "BUDIBASE",
"type": "budibase",
},
Object {
"config": Object {},
{
"config": {},
"createdAt": "2020-01-01T00:00:00.000Z",
"name": "Test",
"source": "POSTGRES",

View file

@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`/views query returns data for the created view 1`] = `
Array [
Object {
[
{
"avg": 2333.3333333333335,
"count": 3,
"group": null,
@ -15,8 +15,8 @@ Array [
`;
exports[`/views query returns data for the created view using a group by 1`] = `
Array [
Object {
[
{
"avg": 1500,
"count": 2,
"group": "One",
@ -25,7 +25,7 @@ Array [
"sum": 3000,
"sumsqr": 5000000,
},
Object {
{
"avg": 4000,
"count": 1,
"group": "Two",

File diff suppressed because it is too large Load diff