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:
parent
82286d519f
commit
926ee18703
6 changed files with 557 additions and 1575 deletions
|
@ -15,6 +15,7 @@
|
||||||
"debug": "yarn build && node --expose-gc --inspect=9222 dist/index.js",
|
"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/",
|
"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": "bash scripts/test.sh",
|
||||||
|
"test:memory": "jest --maxWorkers=2 --logHeapUsage --forceExit",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client",
|
"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",
|
"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/core": "7.17.4",
|
||||||
"@babel/preset-env": "7.16.11",
|
"@babel/preset-env": "7.16.11",
|
||||||
"@budibase/standard-components": "^0.9.139",
|
"@budibase/standard-components": "^0.9.139",
|
||||||
"@jest/test-sequencer": "24.9.0",
|
"@jest/test-sequencer": "29.5.0",
|
||||||
"@swc/core": "^1.3.25",
|
"@swc/core": "^1.3.25",
|
||||||
"@swc/jest": "^0.2.24",
|
"@swc/jest": "^0.2.24",
|
||||||
"@trendyol/jest-testcontainers": "^2.1.1",
|
"@trendyol/jest-testcontainers": "^2.1.1",
|
||||||
|
@ -134,7 +135,7 @@
|
||||||
"@types/global-agent": "2.1.1",
|
"@types/global-agent": "2.1.1",
|
||||||
"@types/google-spreadsheet": "3.1.5",
|
"@types/google-spreadsheet": "3.1.5",
|
||||||
"@types/ioredis": "4.28.10",
|
"@types/ioredis": "4.28.10",
|
||||||
"@types/jest": "27.5.1",
|
"@types/jest": "29.5.0",
|
||||||
"@types/koa": "2.13.4",
|
"@types/koa": "2.13.4",
|
||||||
"@types/koa__router": "8.0.8",
|
"@types/koa__router": "8.0.8",
|
||||||
"@types/lodash": "4.14.180",
|
"@types/lodash": "4.14.180",
|
||||||
|
@ -154,7 +155,7 @@
|
||||||
"eslint": "6.8.0",
|
"eslint": "6.8.0",
|
||||||
"ioredis-mock": "7.2.0",
|
"ioredis-mock": "7.2.0",
|
||||||
"is-wsl": "2.2.0",
|
"is-wsl": "2.2.0",
|
||||||
"jest": "28.1.1",
|
"jest": "29.5.0",
|
||||||
"jest-openapi": "0.14.2",
|
"jest-openapi": "0.14.2",
|
||||||
"jest-serial-runner": "^1.2.1",
|
"jest-serial-runner": "^1.2.1",
|
||||||
"nodemon": "2.0.15",
|
"nodemon": "2.0.15",
|
||||||
|
@ -166,7 +167,7 @@
|
||||||
"supertest": "6.2.2",
|
"supertest": "6.2.2",
|
||||||
"swagger-jsdoc": "6.1.0",
|
"swagger-jsdoc": "6.1.0",
|
||||||
"timekeeper": "2.2.0",
|
"timekeeper": "2.2.0",
|
||||||
"ts-jest": "28.0.4",
|
"ts-jest": "29.0.5",
|
||||||
"ts-node": "10.8.1",
|
"ts-node": "10.8.1",
|
||||||
"tsconfig-paths": "4.0.0",
|
"tsconfig-paths": "4.0.0",
|
||||||
"typescript": "4.7.3",
|
"typescript": "4.7.3",
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
if [[ -n $CI ]]
|
if [[ -n $CI ]]
|
||||||
then
|
then
|
||||||
# --runInBand performs better in ci where resources are limited
|
# --runInBand performs better in ci where resources are limited
|
||||||
echo "jest --coverage --runInBand"
|
echo "jest --coverage --runInBand --forceExit --workerIdleMemoryLimit=1000MB"
|
||||||
jest --coverage --runInBand
|
jest --coverage --runInBand --forceExit --workerIdleMemoryLimit=1000MB
|
||||||
else
|
else
|
||||||
# --maxWorkers performs better in development
|
# --maxWorkers performs better in development
|
||||||
echo "jest --coverage --maxWorkers=2"
|
echo "jest --coverage --maxWorkers=2 --forceExit --workerIdleMemoryLimit=1000MB"
|
||||||
jest --coverage --maxWorkers=2
|
jest --coverage --maxWorkers=2 --forceExit --workerIdleMemoryLimit=1000MB
|
||||||
fi
|
fi
|
|
@ -1,48 +1,48 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`viewBuilder Calculate and filter creates a view with the calculation statistics and filter schema 1`] = `
|
exports[`viewBuilder Calculate and filter creates a view with the calculation statistics and filter schema 1`] = `
|
||||||
Object {
|
{
|
||||||
"map": "function (doc) {
|
"map": "function (doc) {
|
||||||
if ((doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && !(
|
if ((doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" && !(
|
||||||
doc[\\"myField\\"] === undefined ||
|
doc["myField"] === undefined ||
|
||||||
doc[\\"myField\\"] === null ||
|
doc["myField"] === null ||
|
||||||
doc[\\"myField\\"] === \\"\\" ||
|
doc["myField"] === "" ||
|
||||||
(Array.isArray(doc[\\"myField\\"]) && doc[\\"myField\\"].length === 0)
|
(Array.isArray(doc["myField"]) && doc["myField"].length === 0)
|
||||||
)) && (doc[\\"age\\"] > 17)) {
|
)) && (doc["age"] > 17)) {
|
||||||
emit(doc[\\"_id\\"], doc[\\"myField\\"]);
|
emit(doc["_id"], doc["myField"]);
|
||||||
}
|
}
|
||||||
}",
|
}",
|
||||||
"meta": Object {
|
"meta": {
|
||||||
"calculation": "stats",
|
"calculation": "stats",
|
||||||
"field": "myField",
|
"field": "myField",
|
||||||
"filters": Array [
|
"filters": [
|
||||||
Object {
|
{
|
||||||
"condition": "MT",
|
"condition": "MT",
|
||||||
"key": "age",
|
"key": "age",
|
||||||
"value": 17,
|
"value": 17,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"groupBy": undefined,
|
"groupBy": undefined,
|
||||||
"schema": Object {
|
"schema": {
|
||||||
"avg": Object {
|
"avg": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"count": Object {
|
"count": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"field": Object {
|
"field": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"max": Object {
|
"max": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"min": Object {
|
"min": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"sum": Object {
|
"sum": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"sumsqr": Object {
|
"sumsqr": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -53,42 +53,42 @@ Object {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`viewBuilder Calculate creates a view with the calculation statistics schema 1`] = `
|
exports[`viewBuilder Calculate creates a view with the calculation statistics schema 1`] = `
|
||||||
Object {
|
{
|
||||||
"map": "function (doc) {
|
"map": "function (doc) {
|
||||||
if ((doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && !(
|
if ((doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" && !(
|
||||||
doc[\\"myField\\"] === undefined ||
|
doc["myField"] === undefined ||
|
||||||
doc[\\"myField\\"] === null ||
|
doc["myField"] === null ||
|
||||||
doc[\\"myField\\"] === \\"\\" ||
|
doc["myField"] === "" ||
|
||||||
(Array.isArray(doc[\\"myField\\"]) && doc[\\"myField\\"].length === 0)
|
(Array.isArray(doc["myField"]) && doc["myField"].length === 0)
|
||||||
)) ) {
|
)) ) {
|
||||||
emit(doc[\\"_id\\"], doc[\\"myField\\"]);
|
emit(doc["_id"], doc["myField"]);
|
||||||
}
|
}
|
||||||
}",
|
}",
|
||||||
"meta": Object {
|
"meta": {
|
||||||
"calculation": "stats",
|
"calculation": "stats",
|
||||||
"field": "myField",
|
"field": "myField",
|
||||||
"filters": Array [],
|
"filters": [],
|
||||||
"groupBy": undefined,
|
"groupBy": undefined,
|
||||||
"schema": Object {
|
"schema": {
|
||||||
"avg": Object {
|
"avg": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"count": Object {
|
"count": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"field": Object {
|
"field": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"max": Object {
|
"max": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"min": Object {
|
"min": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"sum": Object {
|
"sum": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"sumsqr": Object {
|
"sumsqr": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -99,22 +99,22 @@ Object {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`viewBuilder Filter creates a view with multiple filters and conjunctions 1`] = `
|
exports[`viewBuilder Filter creates a view with multiple filters and conjunctions 1`] = `
|
||||||
Object {
|
{
|
||||||
"map": "function (doc) {
|
"map": "function (doc) {
|
||||||
if (doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && (doc[\\"Name\\"] === \\"Test\\" || doc[\\"Yes\\"] > \\"Value\\")) {
|
if (doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" && (doc["Name"] === "Test" || doc["Yes"] > "Value")) {
|
||||||
emit(doc[\\"_id\\"], doc[\\"undefined\\"]);
|
emit(doc["_id"], doc["undefined"]);
|
||||||
}
|
}
|
||||||
}",
|
}",
|
||||||
"meta": Object {
|
"meta": {
|
||||||
"calculation": undefined,
|
"calculation": undefined,
|
||||||
"field": undefined,
|
"field": undefined,
|
||||||
"filters": Array [
|
"filters": [
|
||||||
Object {
|
{
|
||||||
"condition": "EQUALS",
|
"condition": "EQUALS",
|
||||||
"key": "Name",
|
"key": "Name",
|
||||||
"value": "Test",
|
"value": "Test",
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"condition": "MT",
|
"condition": "MT",
|
||||||
"conjunction": "OR",
|
"conjunction": "OR",
|
||||||
"key": "Yes",
|
"key": "Yes",
|
||||||
|
@ -129,16 +129,16 @@ Object {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`viewBuilder Group By creates a view emitting the group by field 1`] = `
|
exports[`viewBuilder Group By creates a view emitting the group by field 1`] = `
|
||||||
Object {
|
{
|
||||||
"map": "function (doc) {
|
"map": "function (doc) {
|
||||||
if (doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" ) {
|
if (doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" ) {
|
||||||
emit(doc[\\"age\\"], doc[\\"score\\"]);
|
emit(doc["age"], doc["score"]);
|
||||||
}
|
}
|
||||||
}",
|
}",
|
||||||
"meta": Object {
|
"meta": {
|
||||||
"calculation": undefined,
|
"calculation": undefined,
|
||||||
"field": "score",
|
"field": "score",
|
||||||
"filters": Array [],
|
"filters": [],
|
||||||
"groupBy": "age",
|
"groupBy": "age",
|
||||||
"schema": null,
|
"schema": null,
|
||||||
"tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",
|
"tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`/datasources fetch returns all the datasources from the server 1`] = `
|
exports[`/datasources fetch returns all the datasources from the server 1`] = `
|
||||||
Array [
|
[
|
||||||
Object {
|
{
|
||||||
"config": Object {},
|
"config": {},
|
||||||
"entities": Array [
|
"entities": [
|
||||||
Object {
|
{
|
||||||
"_id": "ta_users",
|
"_id": "ta_users",
|
||||||
"_rev": "1-2375e1bc58aeec664dc1b1f04ad43e44",
|
"_rev": "1-2375e1bc58aeec664dc1b1f04ad43e44",
|
||||||
"createdAt": "2020-01-01T00:00:00.000Z",
|
"createdAt": "2020-01-01T00:00:00.000Z",
|
||||||
"name": "Users",
|
"name": "Users",
|
||||||
"primaryDisplay": "email",
|
"primaryDisplay": "email",
|
||||||
"schema": Object {
|
"schema": {
|
||||||
"email": Object {
|
"email": {
|
||||||
"constraints": Object {
|
"constraints": {
|
||||||
"email": true,
|
"email": true,
|
||||||
"length": Object {
|
"length": {
|
||||||
"maximum": "",
|
"maximum": "",
|
||||||
},
|
},
|
||||||
"presence": true,
|
"presence": true,
|
||||||
|
@ -25,8 +25,8 @@ Array [
|
||||||
"name": "email",
|
"name": "email",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"firstName": Object {
|
"firstName": {
|
||||||
"constraints": Object {
|
"constraints": {
|
||||||
"presence": false,
|
"presence": false,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
|
@ -34,8 +34,8 @@ Array [
|
||||||
"name": "firstName",
|
"name": "firstName",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"lastName": Object {
|
"lastName": {
|
||||||
"constraints": Object {
|
"constraints": {
|
||||||
"presence": false,
|
"presence": false,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
|
@ -43,9 +43,9 @@ Array [
|
||||||
"name": "lastName",
|
"name": "lastName",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"roleId": Object {
|
"roleId": {
|
||||||
"constraints": Object {
|
"constraints": {
|
||||||
"inclusion": Array [
|
"inclusion": [
|
||||||
"ADMIN",
|
"ADMIN",
|
||||||
"POWER",
|
"POWER",
|
||||||
"BASIC",
|
"BASIC",
|
||||||
|
@ -58,9 +58,9 @@ Array [
|
||||||
"name": "roleId",
|
"name": "roleId",
|
||||||
"type": "options",
|
"type": "options",
|
||||||
},
|
},
|
||||||
"status": Object {
|
"status": {
|
||||||
"constraints": Object {
|
"constraints": {
|
||||||
"inclusion": Array [
|
"inclusion": [
|
||||||
"active",
|
"active",
|
||||||
"inactive",
|
"inactive",
|
||||||
],
|
],
|
||||||
|
@ -74,15 +74,15 @@ Array [
|
||||||
},
|
},
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"updatedAt": "2020-01-01T00:00:00.000Z",
|
"updatedAt": "2020-01-01T00:00:00.000Z",
|
||||||
"views": Object {},
|
"views": {},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"name": "Budibase DB",
|
"name": "Budibase DB",
|
||||||
"source": "BUDIBASE",
|
"source": "BUDIBASE",
|
||||||
"type": "budibase",
|
"type": "budibase",
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"config": Object {},
|
"config": {},
|
||||||
"createdAt": "2020-01-01T00:00:00.000Z",
|
"createdAt": "2020-01-01T00:00:00.000Z",
|
||||||
"name": "Test",
|
"name": "Test",
|
||||||
"source": "POSTGRES",
|
"source": "POSTGRES",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`/views query returns data for the created view 1`] = `
|
exports[`/views query returns data for the created view 1`] = `
|
||||||
Array [
|
[
|
||||||
Object {
|
{
|
||||||
"avg": 2333.3333333333335,
|
"avg": 2333.3333333333335,
|
||||||
"count": 3,
|
"count": 3,
|
||||||
"group": null,
|
"group": null,
|
||||||
|
@ -15,8 +15,8 @@ Array [
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`/views query returns data for the created view using a group by 1`] = `
|
exports[`/views query returns data for the created view using a group by 1`] = `
|
||||||
Array [
|
[
|
||||||
Object {
|
{
|
||||||
"avg": 1500,
|
"avg": 1500,
|
||||||
"count": 2,
|
"count": 2,
|
||||||
"group": "One",
|
"group": "One",
|
||||||
|
@ -25,7 +25,7 @@ Array [
|
||||||
"sum": 3000,
|
"sum": 3000,
|
||||||
"sumsqr": 5000000,
|
"sumsqr": 5000000,
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"avg": 4000,
|
"avg": 4000,
|
||||||
"count": 1,
|
"count": 1,
|
||||||
"group": "Two",
|
"group": "Two",
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue