From bd344b8842738293980b66b5b4fcac46f98c85c5 Mon Sep 17 00:00:00 2001 From: Jan Klaas Kollhof Date: Tue, 21 Apr 2020 13:29:31 +0200 Subject: [PATCH 1/2] refactor(jest): use @fink/jest wrappers for jest --- jest.config.js | 2 +- package-lock.json | 210 +++++++++++++-------------- package.json | 2 +- src/lang/arithmitic/index.test.fnk | 2 +- src/lang/assignment/index.test.fnk | 2 +- src/lang/async/index.test.fnk | 2 +- src/lang/block/index.test.fnk | 2 +- src/lang/call/call.test.fnk | 2 +- src/lang/comments/index.test.fnk | 2 +- src/lang/comparison/index.test.fnk | 2 +- src/lang/conditionals/index.test.fnk | 2 +- src/lang/func/index.test.fnk | 2 +- src/lang/group/index.test.fnk | 2 +- src/lang/identifier/index.test.fnk | 2 +- src/lang/import/index.test.fnk | 2 +- src/lang/iterable/index.test.fnk | 2 +- src/lang/js-compat/index.test.fnk | 2 +- src/lang/jsx/index.test.fnk | 2 +- src/lang/literals/array.test.fnk | 2 +- src/lang/literals/number.test.fnk | 2 +- src/lang/literals/object.test.fnk | 2 +- src/lang/literals/regex.test.fnk | 2 +- src/lang/literals/string.test.fnk | 2 +- src/lang/logical/index.test.fnk | 2 +- src/lang/module/index.test.fnk | 2 +- src/lang/partial/index.test.fnk | 2 +- src/lang/prop-access/index.test.fnk | 2 +- src/lang/spread/index.test.fnk | 2 +- src/lang/whitespace/index.test.fnk | 2 +- src/testing/jest.fnk | 25 ---- 30 files changed, 126 insertions(+), 165 deletions(-) delete mode 100644 src/testing/jest.fnk diff --git a/jest.config.js b/jest.config.js index 28bc114..556f61d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,7 +4,7 @@ module.exports = { setupFiles: [], moduleFileExtensions: ['js', 'fnk'], transform: { - '^.+\\.fnk$': ['@fink/jest'] + '^.+\\.fnk$': ['@fink/jest/transform'] }, transformIgnorePatterns: ['/node_modules/', '/build/'], diff --git a/package-lock.json b/package-lock.json index 96c596c..0f4af74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -391,18 +391,18 @@ } }, "@fink/jest": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@fink/jest/-/jest-1.1.0.tgz", - "integrity": "sha512-jKLyNpHcbFqT1SR1eZUfDOE36q/VQ9EPQgNiAZBXix79tVqwyKmyeRK1hGQvJBoyNYBTeMz9PbcawF0jyhy4IQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@fink/jest/-/jest-2.0.0.tgz", + "integrity": "sha512-ZDBvLnOT40etJykMgopF3ZdqvliivXi183NB51YaK1xPMKnT3n9VMNt23LkfJ56Xunu0hKZ3n17zvQlZ5tszSg==", "dev": true, "requires": { - "@babel/core": "^7.8.6" + "@babel/core": "^7.9.0" } }, "@fink/larix": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@fink/larix/-/larix-6.0.1.tgz", - "integrity": "sha512-X9XGHzD8J77/Q9dPi4qsXTMTH/2UxhErk+8uek3TcrhLic9U3gmRvFfm5nv9UPh2cRBhpq5k/w+y3yVI80sbog==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@fink/larix/-/larix-6.0.2.tgz", + "integrity": "sha512-+6JxMt5c2dJMxcBusf68TODbkF3CGF793WDDw/Bx7KTKgvog2p/QMdziBO/quoTxqi0iODx6ppe6FoOnN+3OPw==", "dev": true, "requires": { "@fink/prattler": "^3.0.1" @@ -602,6 +602,12 @@ "requires": { "is-number": "^7.0.0" } + }, + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true } } }, @@ -926,12 +932,12 @@ } }, "@octokit/endpoint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.0.tgz", - "integrity": "sha512-3nx+MEYoZeD0uJ+7F/gvELLvQJzLXhep2Az0bBSXagbApDvDW0LWwpnAIY/hb0Jwe17A0fJdz0O12dPh05cj7A==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.1.tgz", + "integrity": "sha512-pOPHaSz57SFT/m3R5P8MUu4wLPszokn5pXcB/pzavLTQf2jbU+6iayTvzaY6/BiotuRS0qyEUkx3QglT4U958A==", "dev": true, "requires": { - "@octokit/types": "^2.0.0", + "@octokit/types": "^2.11.1", "is-plain-object": "^3.0.0", "universal-user-agent": "^5.0.0" }, @@ -991,24 +997,24 @@ "dev": true }, "@octokit/plugin-rest-endpoint-methods": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-3.5.2.tgz", - "integrity": "sha512-i5GlEWm7k/SzBr7QrIOuas/1nNgr4JcmgM14TAKULVkv4L5mOY+pcVIUMU3qdYhFyblBFhigujav5seMnkqBnQ==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-3.7.1.tgz", + "integrity": "sha512-YOlcE3bbk2ohaOVdRj9ww7AUYfmnS9hwJJGSj3/rFlNfMGOId4G8dLlhghXpdNSn05H0FRoI94UlFUKnn30Cyw==", "dev": true, "requires": { - "@octokit/types": "^2.0.1", + "@octokit/types": "^2.11.1", "deprecation": "^2.3.1" } }, "@octokit/request": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.0.tgz", - "integrity": "sha512-uAJO6GI8z8VHBqtY7VTL9iFy1Y+UTp5ShpI97tY5z0qBfYKE9rZCRsCm23VmF00x+IoNJ7a0nuVITs/+wS9/mg==", + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.2.tgz", + "integrity": "sha512-zKdnGuQ2TQ2vFk9VU8awFT4+EYf92Z/v3OlzRaSh4RIP0H6cvW1BFPXq4XYvNez+TPQjqN+0uSkCYnMFFhcFrw==", "dev": true, "requires": { - "@octokit/endpoint": "^6.0.0", + "@octokit/endpoint": "^6.0.1", "@octokit/request-error": "^2.0.0", - "@octokit/types": "^2.8.2", + "@octokit/types": "^2.11.1", "deprecation": "^2.0.0", "is-plain-object": "^3.0.0", "node-fetch": "^2.3.0", @@ -1045,21 +1051,21 @@ } }, "@octokit/rest": { - "version": "17.3.0", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-17.3.0.tgz", - "integrity": "sha512-zqvsnWUEldmF3sCmGGlQ2u+NDQMpF5O4gnwefnGt6yJcN6eGWDYJJvRD/wQ1/nALXU0XABhQElBgR/0wNoprsA==", + "version": "17.5.1", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-17.5.1.tgz", + "integrity": "sha512-0rGY7eo0cw8FYX7jAtUgfy3j+05zhs9JvkPFegx00HAaayodM1ixlHhCOB5yirGbsVOxbRIWVkvKc2yY9367gg==", "dev": true, "requires": { "@octokit/core": "^2.4.3", "@octokit/plugin-paginate-rest": "^2.1.0", "@octokit/plugin-request-log": "^1.0.0", - "@octokit/plugin-rest-endpoint-methods": "3.5.2" + "@octokit/plugin-rest-endpoint-methods": "3.7.1" } }, "@octokit/types": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.11.0.tgz", - "integrity": "sha512-529y4NAqpSql3S243M4m90w2ae2x1fBydvxBKCs2xHVSBIcC35YaCh34OmX2ZM6hWyu13pg3QwBtMGTkog185A==", + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.11.1.tgz", + "integrity": "sha512-QaLoLkmFdfoNbk3eOzPv7vKrUY0nRJIYmZDoz/pTer4ICpqu80aSQTVHnnUxEFuURCiidig76CcxUOYC/bY3RQ==", "dev": true, "requires": { "@types/node": ">= 8" @@ -1295,36 +1301,12 @@ "mimic-fn": "^2.1.0" } }, - "parse-json": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", - "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1", - "lines-and-columns": "^1.1.6" - } - }, "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, - "read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - } - }, "registry-auth-token": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz", @@ -1355,12 +1337,6 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, - "type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true - }, "universalify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", @@ -1417,9 +1393,9 @@ } }, "@tootallnate/once": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.0.0.tgz", - "integrity": "sha512-KYyTT/T6ALPkIRd2Ge080X/BsXvy9O0hcWTtMWkPvwAwF99+vn6Dv4GzrFT/Nn1LePr+FFDbRXXlqmsy9lw2zA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.1.tgz", + "integrity": "sha512-8foiU77JL9wR2yPZwecqN2YdJp/olC4CBVEaHdWWlz5rMQZcVEA3aXxlbfbUACVVxVwtTle3eYSnpBeKvIYcIg==", "dev": true }, "@types/babel__core": { @@ -1495,9 +1471,9 @@ } }, "@types/node": { - "version": "13.13.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.0.tgz", - "integrity": "sha512-WE4IOAC6r/yBZss1oQGM5zs2D7RuKR6Q+w+X2SouPofnWn+LbCqClRyhO3ZE7Ix8nmFgo/oVuuE01cJT2XB13A==", + "version": "13.13.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.1.tgz", + "integrity": "sha512-uysqysLJ+As9jqI5yqjwP3QJrhOcUwBjHUlUxPxjbplwKoILvXVsmYWEhfmAQlrPfbRZmhJB007o4L9sKqtHqQ==", "dev": true }, "@types/normalize-package-data": { @@ -5581,6 +5557,12 @@ "requires": { "has-flag": "^4.0.0" } + }, + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true } } }, @@ -6250,6 +6232,12 @@ "requires": { "has-flag": "^4.0.0" } + }, + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true } } }, @@ -6344,6 +6332,17 @@ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, "read-pkg-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", @@ -10716,25 +10715,15 @@ "dev": true }, "read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", - "dev": true, - "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - } - }, - "read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", "dev": true, "requires": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" }, "dependencies": { "parse-json": { @@ -10749,34 +10738,25 @@ "lines-and-columns": "^1.1.6" } }, - "read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "dependencies": { - "type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true - } - } - }, "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", "dev": true } } }, + "read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "requires": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + } + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -11714,9 +11694,9 @@ } }, "spdx-exceptions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", - "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", "dev": true }, "spdx-expression-parse": { @@ -12082,6 +12062,12 @@ "requires": { "type-fest": "^0.11.0" } + }, + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true } } }, @@ -12267,9 +12253,9 @@ "dev": true }, "type-fest": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, "typedarray-to-buffer": { @@ -12716,9 +12702,9 @@ "dev": true }, "yaml": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.9.1.tgz", - "integrity": "sha512-xbWX1ayUVoW8DPM8qxOBowac4XxSTi0mFLbiokRq880ViYglN+F3nJ4Dc2GdypXpykrknKS39d8I3lzFoHv1kA==", + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.9.2.tgz", + "integrity": "sha512-HPT7cGGI0DuRcsO51qC1j9O16Dh1mZ2bnXwsi0jrSpsLz0WxOLSLXfkABVl6bZO629py3CU+OMJtpNHDLB97kg==", "dev": true, "requires": { "@babel/runtime": "^7.9.2" diff --git a/package.json b/package.json index 23accd9..f88c7be 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ }, "devDependencies": { "@fink/cli": "^3.0.0", - "@fink/jest": "^1.1.0", + "@fink/jest": "^2.0.0", "@fink/larix": "^6.0.1", "@fink/loxia": "^4.11.0", "commitizen": "^4.0.3", diff --git a/src/lang/arithmitic/index.test.fnk b/src/lang/arithmitic/index.test.fnk index b58816a..fbc1210 100644 --- a/src/lang/arithmitic/index.test.fnk +++ b/src/lang/arithmitic/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/assignment/index.test.fnk b/src/lang/assignment/index.test.fnk index abcce23..d72ccfb 100644 --- a/src/lang/assignment/index.test.fnk +++ b/src/lang/assignment/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/async/index.test.fnk b/src/lang/async/index.test.fnk index 217141d..7837633 100644 --- a/src/lang/async/index.test.fnk +++ b/src/lang/async/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/block/index.test.fnk b/src/lang/block/index.test.fnk index 0f7b587..24f59fd 100644 --- a/src/lang/block/index.test.fnk +++ b/src/lang/block/index.test.fnk @@ -1,4 +1,4 @@ -{decribe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse} = import '../..' diff --git a/src/lang/call/call.test.fnk b/src/lang/call/call.test.fnk index cd3277a..116452f 100644 --- a/src/lang/call/call.test.fnk +++ b/src/lang/call/call.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr} = import '../..' diff --git a/src/lang/comments/index.test.fnk b/src/lang/comments/index.test.fnk index 70df03c..3dbbf61 100644 --- a/src/lang/comments/index.test.fnk +++ b/src/lang/comments/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse} = import '../../' diff --git a/src/lang/comparison/index.test.fnk b/src/lang/comparison/index.test.fnk index b4baa6a..d4a95ea 100644 --- a/src/lang/comparison/index.test.fnk +++ b/src/lang/comparison/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/conditionals/index.test.fnk b/src/lang/conditionals/index.test.fnk index 14f2847..fbc5580 100644 --- a/src/lang/conditionals/index.test.fnk +++ b/src/lang/conditionals/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse} = import '../../' diff --git a/src/lang/func/index.test.fnk b/src/lang/func/index.test.fnk index 5d8a655..f13383e 100644 --- a/src/lang/func/index.test.fnk +++ b/src/lang/func/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../..' diff --git a/src/lang/group/index.test.fnk b/src/lang/group/index.test.fnk index 9259420..017c16e 100644 --- a/src/lang/group/index.test.fnk +++ b/src/lang/group/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../..' diff --git a/src/lang/identifier/index.test.fnk b/src/lang/identifier/index.test.fnk index 62e072f..5985272 100644 --- a/src/lang/identifier/index.test.fnk +++ b/src/lang/identifier/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr, parse} = import '../../' diff --git a/src/lang/import/index.test.fnk b/src/lang/import/index.test.fnk index 26a2c2a..1f66799 100644 --- a/src/lang/import/index.test.fnk +++ b/src/lang/import/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../..' diff --git a/src/lang/iterable/index.test.fnk b/src/lang/iterable/index.test.fnk index 0d3c6b8..22316e9 100644 --- a/src/lang/iterable/index.test.fnk +++ b/src/lang/iterable/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/js-compat/index.test.fnk b/src/lang/js-compat/index.test.fnk index 2a9543e..4e24b22 100644 --- a/src/lang/js-compat/index.test.fnk +++ b/src/lang/js-compat/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../..' diff --git a/src/lang/jsx/index.test.fnk b/src/lang/jsx/index.test.fnk index 15ca819..0d7ec1b 100644 --- a/src/lang/jsx/index.test.fnk +++ b/src/lang/jsx/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/literals/array.test.fnk b/src/lang/literals/array.test.fnk index 3c10b84..2bb9766 100644 --- a/src/lang/literals/array.test.fnk +++ b/src/lang/literals/array.test.fnk @@ -1,4 +1,4 @@ -{decribe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/literals/number.test.fnk b/src/lang/literals/number.test.fnk index 3ab717b..16a3b88 100644 --- a/src/lang/literals/number.test.fnk +++ b/src/lang/literals/number.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr, parse} = import '../../' diff --git a/src/lang/literals/object.test.fnk b/src/lang/literals/object.test.fnk index b115113..e7e0660 100644 --- a/src/lang/literals/object.test.fnk +++ b/src/lang/literals/object.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/literals/regex.test.fnk b/src/lang/literals/regex.test.fnk index 61b9867..2389d6e 100644 --- a/src/lang/literals/regex.test.fnk +++ b/src/lang/literals/regex.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/literals/string.test.fnk b/src/lang/literals/string.test.fnk index 98227ce..81d80e8 100644 --- a/src/lang/literals/string.test.fnk +++ b/src/lang/literals/string.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_throw, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_throw, to_match_snapshot} = import '@fink/jest' {parse_expr, parse} = import '../../' diff --git a/src/lang/logical/index.test.fnk b/src/lang/logical/index.test.fnk index 65f810f..3981573 100644 --- a/src/lang/logical/index.test.fnk +++ b/src/lang/logical/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/module/index.test.fnk b/src/lang/module/index.test.fnk index 34ea304..fc5fa61 100644 --- a/src/lang/module/index.test.fnk +++ b/src/lang/module/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse} = import '../../' diff --git a/src/lang/partial/index.test.fnk b/src/lang/partial/index.test.fnk index dfeccf3..c10aa3d 100644 --- a/src/lang/partial/index.test.fnk +++ b/src/lang/partial/index.test.fnk @@ -1,4 +1,4 @@ -{decribe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/prop-access/index.test.fnk b/src/lang/prop-access/index.test.fnk index e740f53..33e400d 100644 --- a/src/lang/prop-access/index.test.fnk +++ b/src/lang/prop-access/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot, to_throw} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/spread/index.test.fnk b/src/lang/spread/index.test.fnk index 344e515..e9eecbd 100644 --- a/src/lang/spread/index.test.fnk +++ b/src/lang/spread/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot} = import '../../testing/jest' +{describe, it, expect, to_match_snapshot} = import '@fink/jest' {parse_expr} = import '../../' diff --git a/src/lang/whitespace/index.test.fnk b/src/lang/whitespace/index.test.fnk index 090c275..1a53cd7 100644 --- a/src/lang/whitespace/index.test.fnk +++ b/src/lang/whitespace/index.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_equal} = import '../../testing/jest' +{describe, it, expect, to_equal} = import '@fink/jest' {init_parser, start_parser, next_is_end, next_loc} = import '@fink/prattler' diff --git a/src/testing/jest.fnk b/src/testing/jest.fnk deleted file mode 100644 index 9edc835..0000000 --- a/src/testing/jest.fnk +++ /dev/null @@ -1,25 +0,0 @@ - -describe = fn descr, tests: - global.describe:: descr, fn: - tests() - undefined - - -it = fn descr, test: - global.it:: descr, test - undefined - -to_equal = fn expected: fn expect_actual: - expect_actual.toEqual:: expected - - -to_match_snapshot = fn expect_actual: - expect_actual.toMatchSnapshot() - - -to_throw = fn expected: fn expect_actual: - expect_actual.toThrow:: expected - - -expect = fn actual, expectation: - expectation:: global.expect:: actual From c1e37d09385b39c218b14ce91991778982b2c63d Mon Sep 17 00:00:00 2001 From: Jan Klaas Kollhof Date: Tue, 21 Apr 2020 17:19:11 +0200 Subject: [PATCH 2/2] fix(block): fix detection of empty expressions --- src/lang/block/index.fnk | 14 +++++++------- src/lang/block/index.test.fnk.snap | 1 - src/lang/literals/array.test.fnk | 9 ++++++++- src/lang/literals/array.test.fnk.snap | 7 +++++++ 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/lang/block/index.fnk b/src/lang/block/index.fnk index cdaf9ac..98859dd 100644 --- a/src/lang/block/index.fnk +++ b/src/lang/block/index.fnk @@ -59,15 +59,15 @@ get_all = fn ctx, single_expr: match at_start: true: expr = empty_op:: ctx.next_token - match was_comma: - true: - expr0 = empty_op:: ctx.curr_token - [false, [[...exprs, expr0, expr], next_ctx, true, false]] - else: - [false, [[...exprs, expr], next_ctx, true, false]] + [false, [[...exprs, expr], next_ctx, true, false]] else: + match next_ctx: + next_is:: ?, ',': + expr = empty_op:: ctx.next_token + [false, [[...exprs, expr], next_ctx, false, false]] + else: + [false, [exprs, next_ctx, true, true]] - [false, [exprs, next_ctx, true, true]] else: match at_start: false: diff --git a/src/lang/block/index.test.fnk.snap b/src/lang/block/index.test.fnk.snap index 89d8fc6..661ce4d 100644 --- a/src/lang/block/index.test.fnk.snap +++ b/src/lang/block/index.test.fnk.snap @@ -44,7 +44,6 @@ module (1:0-4:0) number (1:0-1:1) 1 number (2:0-2:1) 2 empty (2:2-2:2) - empty (2:3-2:3) number (3:0-3:1) 3 empty (3:2-3:2) `; diff --git a/src/lang/literals/array.test.fnk b/src/lang/literals/array.test.fnk index 2bb9766..2755474 100644 --- a/src/lang/literals/array.test.fnk +++ b/src/lang/literals/array.test.fnk @@ -1,4 +1,4 @@ -{describe, it, expect, to_match_snapshot, to_throw} = import '@fink/jest' +{describe, it, only, expect, to_match_snapshot, to_throw} = import '@fink/jest' {parse_expr} = import '../../' @@ -33,6 +33,13 @@ describe:: 'array [...]', fn: to_match_snapshot + it:: 'parses middle commas: [,, foo]', fn: + expect:: + # [a, , ..., b, c] + parse_expr:: `[foo, ,bar]` + to_match_snapshot + + it:: 'parses trailing commas: [...foo,,]', fn: expect:: parse_expr:: `[...foo, ]` diff --git a/src/lang/literals/array.test.fnk.snap b/src/lang/literals/array.test.fnk.snap index 7591671..2737126 100644 --- a/src/lang/literals/array.test.fnk.snap +++ b/src/lang/literals/array.test.fnk.snap @@ -12,6 +12,13 @@ array (1:0-1:8) ident (1:4-1:7) foo `; +exports[`array [...] parses middle commas: [,, foo] 1`] = ` +array (1:0-1:11) + ident (1:1-1:4) foo + empty (1:5-1:5) + ident (1:7-1:10) bar +`; + exports[`array [...] parses multiple elements: [1, 2] 1`] = ` array (1:0-1:6) number (1:1-1:2) 1