From 46e76ef0d795a99e0695313a74f7299802e8df50 Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Mon, 27 Nov 2023 12:07:21 -0800 Subject: [PATCH 1/3] Add no focused jest tests eslint rule --- langchain-core/.eslintrc.cjs | 3 +- langchain-core/package.json | 1 + langchain/.eslintrc.cjs | 3 +- langchain/package.json | 2 + libs/langchain-anthropic/.eslintrc.cjs | 3 +- libs/langchain-anthropic/package.json | 1 + libs/langchain-openai/.eslintrc.cjs | 3 +- libs/langchain-openai/package.json | 1 + yarn.lock | 137 +++++++++++++++++++++++++ 9 files changed, 150 insertions(+), 4 deletions(-) diff --git a/langchain-core/.eslintrc.cjs b/langchain-core/.eslintrc.cjs index 4adf489ade1c..2d66a327d17b 100644 --- a/langchain-core/.eslintrc.cjs +++ b/langchain-core/.eslintrc.cjs @@ -11,7 +11,7 @@ module.exports = { project: "./tsconfig.json", sourceType: "module", }, - plugins: ["@typescript-eslint", "no-instanceof"], + plugins: ["@typescript-eslint", "no-instanceof", "eslint-plugin-jest"], ignorePatterns: [ "src/utils/@cfworker", "src/utils/fast-json-patch", @@ -65,5 +65,6 @@ module.exports = { "no-lonely-if": 0, "prefer-rest-params": 0, "new-cap": ["error", { properties: false, capIsNew: false }], + 'jest/no-focused-tests': 'error', }, }; diff --git a/langchain-core/package.json b/langchain-core/package.json index 45ee433c91e0..97a1a9082495 100644 --- a/langchain-core/package.json +++ b/langchain-core/package.json @@ -51,6 +51,7 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", + "eslint-plugin-jest": "^27.6.0", "eslint-plugin-no-instanceof": "^1.0.1", "eslint-plugin-prettier": "^4.2.1", "jest": "^29.5.0", diff --git a/langchain/.eslintrc.cjs b/langchain/.eslintrc.cjs index bab396aedde2..efa72569f323 100644 --- a/langchain/.eslintrc.cjs +++ b/langchain/.eslintrc.cjs @@ -11,7 +11,7 @@ module.exports = { project: "./tsconfig.json", sourceType: "module", }, - plugins: ["@typescript-eslint", "no-instanceof"], + plugins: ["@typescript-eslint", "no-instanceof", "eslint-plugin-jest"], ignorePatterns: [ "src/util/@cfworker", "src/util/fast-json-patch", @@ -65,5 +65,6 @@ module.exports = { "no-lonely-if": 0, "prefer-rest-params": 0, "new-cap": ["error", { properties: false, capIsNew: false }], + 'jest/no-focused-tests': 'error', }, }; diff --git a/langchain/package.json b/langchain/package.json index 5194d640e0b8..3c286bb11925 100644 --- a/langchain/package.json +++ b/langchain/package.json @@ -927,6 +927,7 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", + "eslint-plugin-jest": "^27.6.0", "eslint-plugin-no-instanceof": "^1.0.1", "eslint-plugin-prettier": "^4.2.1", "faiss-node": "^0.5.1", @@ -1391,6 +1392,7 @@ "openai": "^4.19.0", "openapi-types": "^12.1.3", "p-retry": "4", + "remove": "^0.1.5", "uuid": "^9.0.0", "yaml": "^2.2.1", "zod": "^3.22.3", diff --git a/libs/langchain-anthropic/.eslintrc.cjs b/libs/langchain-anthropic/.eslintrc.cjs index 4adf489ade1c..2d66a327d17b 100644 --- a/libs/langchain-anthropic/.eslintrc.cjs +++ b/libs/langchain-anthropic/.eslintrc.cjs @@ -11,7 +11,7 @@ module.exports = { project: "./tsconfig.json", sourceType: "module", }, - plugins: ["@typescript-eslint", "no-instanceof"], + plugins: ["@typescript-eslint", "no-instanceof", "eslint-plugin-jest"], ignorePatterns: [ "src/utils/@cfworker", "src/utils/fast-json-patch", @@ -65,5 +65,6 @@ module.exports = { "no-lonely-if": 0, "prefer-rest-params": 0, "new-cap": ["error", { properties: false, capIsNew: false }], + 'jest/no-focused-tests': 'error', }, }; diff --git a/libs/langchain-anthropic/package.json b/libs/langchain-anthropic/package.json index 3dee717d9b20..eaaba4dcbcac 100644 --- a/libs/langchain-anthropic/package.json +++ b/libs/langchain-anthropic/package.json @@ -45,6 +45,7 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", + "eslint-plugin-jest": "^27.6.0", "eslint-plugin-no-instanceof": "^1.0.1", "eslint-plugin-prettier": "^4.2.1", "jest": "^29.5.0", diff --git a/libs/langchain-openai/.eslintrc.cjs b/libs/langchain-openai/.eslintrc.cjs index 4adf489ade1c..2d66a327d17b 100644 --- a/libs/langchain-openai/.eslintrc.cjs +++ b/libs/langchain-openai/.eslintrc.cjs @@ -11,7 +11,7 @@ module.exports = { project: "./tsconfig.json", sourceType: "module", }, - plugins: ["@typescript-eslint", "no-instanceof"], + plugins: ["@typescript-eslint", "no-instanceof", "eslint-plugin-jest"], ignorePatterns: [ "src/utils/@cfworker", "src/utils/fast-json-patch", @@ -65,5 +65,6 @@ module.exports = { "no-lonely-if": 0, "prefer-rest-params": 0, "new-cap": ["error", { properties: false, capIsNew: false }], + 'jest/no-focused-tests': 'error', }, }; diff --git a/libs/langchain-openai/package.json b/libs/langchain-openai/package.json index 3f348059ec94..0f9a811a068e 100644 --- a/libs/langchain-openai/package.json +++ b/libs/langchain-openai/package.json @@ -47,6 +47,7 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", + "eslint-plugin-jest": "^27.6.0", "eslint-plugin-no-instanceof": "^1.0.1", "eslint-plugin-prettier": "^4.2.1", "jest": "^29.5.0", diff --git a/yarn.lock b/yarn.lock index 7814498c3bb2..a6f70c6c9183 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7970,6 +7970,7 @@ __metadata: eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 + eslint-plugin-jest: ^27.6.0 eslint-plugin-no-instanceof: ^1.0.1 eslint-plugin-prettier: ^4.2.1 jest: ^29.5.0 @@ -7996,6 +7997,7 @@ __metadata: eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 + eslint-plugin-jest: ^27.6.0 eslint-plugin-no-instanceof: ^1.0.1 eslint-plugin-prettier: ^4.2.1 jest: ^29.5.0 @@ -8026,6 +8028,7 @@ __metadata: eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 + eslint-plugin-jest: ^27.6.0 eslint-plugin-no-instanceof: ^1.0.1 eslint-plugin-prettier: ^4.2.1 jest: ^29.5.0 @@ -12150,6 +12153,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/scope-manager@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/scope-manager@npm:5.62.0" + dependencies: + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/visitor-keys": 5.62.0 + checksum: 6062d6b797fe1ce4d275bb0d17204c827494af59b5eaf09d8a78cdd39dadddb31074dded4297aaf5d0f839016d601032857698b0e4516c86a41207de606e9573 + languageName: node + linkType: hard + "@typescript-eslint/scope-manager@npm:6.9.1": version: 6.9.1 resolution: "@typescript-eslint/scope-manager@npm:6.9.1" @@ -12208,6 +12221,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/types@npm:5.62.0" + checksum: 48c87117383d1864766486f24de34086155532b070f6264e09d0e6139449270f8a9559cfef3c56d16e3bcfb52d83d42105d61b36743626399c7c2b5e0ac3b670 + languageName: node + linkType: hard + "@typescript-eslint/types@npm:6.9.1": version: 6.9.1 resolution: "@typescript-eslint/types@npm:6.9.1" @@ -12251,6 +12271,24 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/typescript-estree@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" + dependencies: + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/visitor-keys": 5.62.0 + debug: ^4.3.4 + globby: ^11.1.0 + is-glob: ^4.0.3 + semver: ^7.3.7 + tsutils: ^3.21.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 3624520abb5807ed8f57b1197e61c7b1ed770c56dfcaca66372d584ff50175225798bccb701f7ef129d62c5989070e1ee3a0aa2d84e56d9524dcf011a2bb1a52 + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:6.9.1": version: 6.9.1 resolution: "@typescript-eslint/typescript-estree@npm:6.9.1" @@ -12305,6 +12343,24 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/utils@npm:^5.10.0": + version: 5.62.0 + resolution: "@typescript-eslint/utils@npm:5.62.0" + dependencies: + "@eslint-community/eslint-utils": ^4.2.0 + "@types/json-schema": ^7.0.9 + "@types/semver": ^7.3.12 + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/typescript-estree": 5.62.0 + eslint-scope: ^5.1.1 + semver: ^7.3.7 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + checksum: ee9398c8c5db6d1da09463ca7bf36ed134361e20131ea354b2da16a5fdb6df9ba70c62a388d19f6eebb421af1786dbbd79ba95ddd6ab287324fc171c3e28d931 + languageName: node + linkType: hard + "@typescript-eslint/visitor-keys@npm:5.54.1": version: 5.54.1 resolution: "@typescript-eslint/visitor-keys@npm:5.54.1" @@ -12325,6 +12381,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/visitor-keys@npm:5.62.0" + dependencies: + "@typescript-eslint/types": 5.62.0 + eslint-visitor-keys: ^3.3.0 + checksum: 976b05d103fe8335bef5c93ad3f76d781e3ce50329c0243ee0f00c0fcfb186c81df50e64bfdd34970148113f8ade90887f53e3c4938183afba830b4ba8e30a35 + languageName: node + linkType: hard + "@typescript-eslint/visitor-keys@npm:6.9.1": version: 6.9.1 resolution: "@typescript-eslint/visitor-keys@npm:6.9.1" @@ -14276,6 +14342,15 @@ __metadata: languageName: node linkType: hard +"chainsaw@npm:>=0.0.7 <0.1": + version: 0.0.9 + resolution: "chainsaw@npm:0.0.9" + dependencies: + traverse: ">=0.3.0 <0.4" + checksum: 88d19956954f428e6a11d803c6bf608520c3f25974c400165ed6af9628015ef30c333658268dbcf42f2b4ce2cd263fe85b28adafc8a446d8e53ac4c3e25b5219 + languageName: node + linkType: hard + "chalk@npm:5.2.0, chalk@npm:^5.0.0, chalk@npm:^5.0.1, chalk@npm:^5.2.0": version: 5.2.0 resolution: "chalk@npm:5.2.0" @@ -17280,6 +17355,24 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-jest@npm:^27.6.0": + version: 27.6.0 + resolution: "eslint-plugin-jest@npm:27.6.0" + dependencies: + "@typescript-eslint/utils": ^5.10.0 + peerDependencies: + "@typescript-eslint/eslint-plugin": ^5.0.0 || ^6.0.0 + eslint: ^7.0.0 || ^8.0.0 + jest: "*" + peerDependenciesMeta: + "@typescript-eslint/eslint-plugin": + optional: true + jest: + optional: true + checksum: 4c42641f9bf2d597761637028083e20b9f81762308e98baae40eb805d3e81ff8d837f06f4f0c1a2fd249e2be2fb24d33b7aafeaa8942de805c2b8d7c3b6fc4e4 + languageName: node + linkType: hard + "eslint-plugin-jsx-a11y@npm:^6.6.0": version: 6.7.1 resolution: "eslint-plugin-jsx-a11y@npm:6.7.1" @@ -19679,6 +19772,15 @@ __metadata: languageName: node linkType: hard +"hashish@npm:>=0.0.2 <0.1": + version: 0.0.4 + resolution: "hashish@npm:0.0.4" + dependencies: + traverse: ">=0.2.4" + checksum: 8571cee91809661957dba8ae2ca605b1ab1e432b2781e6fc161ffb0caa55658075aecc14a518efe42a5597168dfab37cbdc2483d323851785f234b24b39455da + languageName: node + linkType: hard + "hasown@npm:^2.0.0": version: 2.0.0 resolution: "hasown@npm:2.0.0" @@ -22397,6 +22499,7 @@ __metadata: eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 + eslint-plugin-jest: ^27.6.0 eslint-plugin-no-instanceof: ^1.0.1 eslint-plugin-prettier: ^4.2.1 expr-eval: ^2.0.2 @@ -22443,6 +22546,7 @@ __metadata: puppeteer: ^19.7.2 redis: ^4.6.6 release-it: ^15.10.1 + remove: ^0.1.5 replicate: ^0.18.0 rimraf: ^5.0.1 rollup: ^3.19.1 @@ -27784,6 +27888,15 @@ __metadata: languageName: node linkType: hard +"remove@npm:^0.1.5": + version: 0.1.5 + resolution: "remove@npm:0.1.5" + dependencies: + seq: ">= 0.3.5" + checksum: 5ee886cb3509e09e706789bc4a9014c1d20b0ee6d004db581b382f3a256a45888526e23b36ce441fbd96ba3ecc453a18785d1e0d4d10dddb8e2e118961f93d9f + languageName: node + linkType: hard + "renderkid@npm:^3.0.0": version: 3.0.0 resolution: "renderkid@npm:3.0.0" @@ -28492,6 +28605,16 @@ __metadata: languageName: node linkType: hard +"seq@npm:>= 0.3.5": + version: 0.3.5 + resolution: "seq@npm:0.3.5" + dependencies: + chainsaw: ">=0.0.7 <0.1" + hashish: ">=0.0.2 <0.1" + checksum: 5b35acaadbb39ba26879a4395fe931b76addd90fd8bbca0efed3a96c26ecd003be9bc65d7fbf42b98eeb604f216f2ed22f22b01555aa04208f832d5c9b15403b + languageName: node + linkType: hard + "serialize-javascript@npm:^6.0.0, serialize-javascript@npm:^6.0.1": version: 6.0.1 resolution: "serialize-javascript@npm:6.0.1" @@ -29962,6 +30085,20 @@ __metadata: languageName: node linkType: hard +"traverse@npm:>=0.2.4": + version: 0.6.7 + resolution: "traverse@npm:0.6.7" + checksum: 21018085ab72f717991597e12e2b52446962ed59df591502e4d7e1a709bc0a989f7c3d451aa7d882666ad0634f1546d696c5edecda1f2fc228777df7bb529a1e + languageName: node + linkType: hard + +"traverse@npm:>=0.3.0 <0.4": + version: 0.3.9 + resolution: "traverse@npm:0.3.9" + checksum: 982982e4e249e9bbf063732a41fe5595939892758524bbef5d547c67cdf371b13af72b5434c6a61d88d4bb4351d6dabc6e22d832e0d16bc1bc684ef97a1cc59e + languageName: node + linkType: hard + "trim-trailing-lines@npm:^1.0.0": version: 1.1.4 resolution: "trim-trailing-lines@npm:1.1.4" From 360a9e575f2a01a0e42b12d6e4fa939fba7fc14e Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Mon, 27 Nov 2023 12:57:22 -0800 Subject: [PATCH 2/3] unfocus test --- langchain/src/document_loaders/tests/gitbook.int.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/src/document_loaders/tests/gitbook.int.test.ts b/langchain/src/document_loaders/tests/gitbook.int.test.ts index 8b72dac06f64..04e8b3f26f2f 100644 --- a/langchain/src/document_loaders/tests/gitbook.int.test.ts +++ b/langchain/src/document_loaders/tests/gitbook.int.test.ts @@ -10,7 +10,7 @@ test("Test GitbookLoader", async () => { console.log("Loaded", docs.length, "Gitbook documents"); }); -test.only("Test GitbookLoader with shouldLoadAllPaths", async () => { +test("Test GitbookLoader with shouldLoadAllPaths", async () => { const loader = new GitbookLoader("https://docs.maildrop.cc", { shouldLoadAllPaths: true, }); From 36e6cb96e137cbd4f892ad7ba25ad8cf0e027210 Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Mon, 27 Nov 2023 13:20:25 -0800 Subject: [PATCH 3/3] remove --- langchain/package.json | 1 - yarn.lock | 52 ------------------------------------------ 2 files changed, 53 deletions(-) diff --git a/langchain/package.json b/langchain/package.json index 3c286bb11925..8245271f1741 100644 --- a/langchain/package.json +++ b/langchain/package.json @@ -1392,7 +1392,6 @@ "openai": "^4.19.0", "openapi-types": "^12.1.3", "p-retry": "4", - "remove": "^0.1.5", "uuid": "^9.0.0", "yaml": "^2.2.1", "zod": "^3.22.3", diff --git a/yarn.lock b/yarn.lock index a6f70c6c9183..495765f84681 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14342,15 +14342,6 @@ __metadata: languageName: node linkType: hard -"chainsaw@npm:>=0.0.7 <0.1": - version: 0.0.9 - resolution: "chainsaw@npm:0.0.9" - dependencies: - traverse: ">=0.3.0 <0.4" - checksum: 88d19956954f428e6a11d803c6bf608520c3f25974c400165ed6af9628015ef30c333658268dbcf42f2b4ce2cd263fe85b28adafc8a446d8e53ac4c3e25b5219 - languageName: node - linkType: hard - "chalk@npm:5.2.0, chalk@npm:^5.0.0, chalk@npm:^5.0.1, chalk@npm:^5.2.0": version: 5.2.0 resolution: "chalk@npm:5.2.0" @@ -19772,15 +19763,6 @@ __metadata: languageName: node linkType: hard -"hashish@npm:>=0.0.2 <0.1": - version: 0.0.4 - resolution: "hashish@npm:0.0.4" - dependencies: - traverse: ">=0.2.4" - checksum: 8571cee91809661957dba8ae2ca605b1ab1e432b2781e6fc161ffb0caa55658075aecc14a518efe42a5597168dfab37cbdc2483d323851785f234b24b39455da - languageName: node - linkType: hard - "hasown@npm:^2.0.0": version: 2.0.0 resolution: "hasown@npm:2.0.0" @@ -22546,7 +22528,6 @@ __metadata: puppeteer: ^19.7.2 redis: ^4.6.6 release-it: ^15.10.1 - remove: ^0.1.5 replicate: ^0.18.0 rimraf: ^5.0.1 rollup: ^3.19.1 @@ -27888,15 +27869,6 @@ __metadata: languageName: node linkType: hard -"remove@npm:^0.1.5": - version: 0.1.5 - resolution: "remove@npm:0.1.5" - dependencies: - seq: ">= 0.3.5" - checksum: 5ee886cb3509e09e706789bc4a9014c1d20b0ee6d004db581b382f3a256a45888526e23b36ce441fbd96ba3ecc453a18785d1e0d4d10dddb8e2e118961f93d9f - languageName: node - linkType: hard - "renderkid@npm:^3.0.0": version: 3.0.0 resolution: "renderkid@npm:3.0.0" @@ -28605,16 +28577,6 @@ __metadata: languageName: node linkType: hard -"seq@npm:>= 0.3.5": - version: 0.3.5 - resolution: "seq@npm:0.3.5" - dependencies: - chainsaw: ">=0.0.7 <0.1" - hashish: ">=0.0.2 <0.1" - checksum: 5b35acaadbb39ba26879a4395fe931b76addd90fd8bbca0efed3a96c26ecd003be9bc65d7fbf42b98eeb604f216f2ed22f22b01555aa04208f832d5c9b15403b - languageName: node - linkType: hard - "serialize-javascript@npm:^6.0.0, serialize-javascript@npm:^6.0.1": version: 6.0.1 resolution: "serialize-javascript@npm:6.0.1" @@ -30085,20 +30047,6 @@ __metadata: languageName: node linkType: hard -"traverse@npm:>=0.2.4": - version: 0.6.7 - resolution: "traverse@npm:0.6.7" - checksum: 21018085ab72f717991597e12e2b52446962ed59df591502e4d7e1a709bc0a989f7c3d451aa7d882666ad0634f1546d696c5edecda1f2fc228777df7bb529a1e - languageName: node - linkType: hard - -"traverse@npm:>=0.3.0 <0.4": - version: 0.3.9 - resolution: "traverse@npm:0.3.9" - checksum: 982982e4e249e9bbf063732a41fe5595939892758524bbef5d547c67cdf371b13af72b5434c6a61d88d4bb4351d6dabc6e22d832e0d16bc1bc684ef97a1cc59e - languageName: node - linkType: hard - "trim-trailing-lines@npm:^1.0.0": version: 1.1.4 resolution: "trim-trailing-lines@npm:1.1.4"