Skip to content

Commit 17eff0a

Browse files
authored
Cleanup some files in node, modernize tests, and update the node matrix (#3928)
* Update supported language versions, refine .gitignore, and enhance Jest configuration Signed-off-by: Avi Fenesh <aviarchi1994@gmail.com> * Enhance comments in setup.ts to clarify the purpose of clearing timers after tests Signed-off-by: Avi Fenesh <aviarchi1994@gmail.com> --------- Signed-off-by: Avi Fenesh <aviarchi1994@gmail.com>
1 parent ab1ce91 commit 17eff0a

File tree

10 files changed

+46
-104
lines changed

10 files changed

+46
-104
lines changed

.github/json_matrices/supported-languages-versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
},
1212
{
1313
"language": "node",
14-
"versions": ["16.x", "18.x", "20.x", "22.x", "23.x"],
15-
"always-run-versions": ["18.x", "22.x"]
14+
"versions": ["16.x", "20.x", "22.x", "23.x"],
15+
"always-run-versions": ["20.x", "23.x"]
1616
},
1717
{
1818
"language": "dotnet",

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ docs/markdown/node/**
6262
docs/site/**
6363
copilot.yml
6464
memory-bank/
65+
CLAUDE*
6566
#cpp files
6667
cpp/benchmarks/build/
6768
cpp/build/
@@ -70,3 +71,7 @@ cpp/include/glide/connection_request.pb.h
7071

7172
cpp/include/glide/glide_base.h
7273
cpp/src/connection_request.pb.cc
74+
75+
**/.claude/settings.local.json
76+
copilot-instructions.md
77+
**/.yarn

.gitmodules

Whitespace-only changes.

eslint.config.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default tseslint.config(
77
eslint.configs.recommended,
88
...tseslint.configs.recommended,
99
...tseslint.configs.stylistic,
10-
{ files: [ "**/*.js" ], ...tseslint.configs.disableTypeChecked },
10+
{ files: ["**/*.js"], ...tseslint.configs.disableTypeChecked },
1111
{
1212
ignores: [
1313
"*/ProtobufMessage.*",
@@ -63,10 +63,10 @@ export default tseslint.config(
6363
ObjectExpression: 1,
6464
FunctionDeclaration: { parameters: "first" },
6565
FunctionExpression: { parameters: "first" },
66-
ignoredNodes: [ "TSTypeParameterInstantiation" ],
66+
ignoredNodes: ["TSTypeParameterInstantiation"],
6767
},
6868
],
6969
},
7070
},
71-
prettierConfig
71+
prettierConfig,
7272
);

node/.gitignore

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,13 @@ coverage
3030
# nyc test coverage
3131
.nyc_output
3232

33-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
34-
.grunt
35-
36-
# Bower dependency directory (https://bower.io/)
37-
bower_components
38-
39-
# node-waf configuration
40-
.lock-wscript
41-
4233
# Compiled binary addons (https://nodejs.org/api/addons.html)
4334
build/Release
4435

4536
# Dependency directories
4637
node_modules/
4738
jspm_packages/
4839

49-
# Snowpack dependency directory (https://snowpack.dev/)
50-
web_modules/
51-
52-
# TypeScript cache
53-
*.tsbuildinfo
54-
5540
# Optional npm cache directory
5641
.npm
5742

@@ -60,13 +45,6 @@ web_modules/
6045

6146
# Optional stylelint cache
6247
.stylelintcache
63-
64-
# Microbundle cache
65-
.rpt2_cache/
66-
.rts2_cache_cjs/
67-
.rts2_cache_es/
68-
.rts2_cache_umd/
69-
7048
# Optional REPL history
7149
.node_repl_history
7250

@@ -83,42 +61,13 @@ web_modules/
8361
.env.production.local
8462
.env.local
8563

86-
# parcel-bundler cache (https://parceljs.org/)
87-
.cache
88-
.parcel-cache
8964

9065
# Next.js build output
9166
.next
9267
out
9368

94-
# Nuxt.js build / generate output
95-
.nuxt
96-
dist
9769

98-
# Gatsby files
99-
.cache/
100-
# Comment in the public line in if your project uses Gatsby and not Next.js
101-
# https://nextjs.org/blog/next-9-1#public-directory-support
102-
# public
103-
104-
# vuepress build output
105-
.vuepress/dist
106-
107-
# vuepress v2.x temp and cache directory
108-
.temp
109-
.cache
110-
111-
# Docusaurus cache and generated files
112-
.docusaurus
113-
114-
# Serverless directories
115-
.serverless/
116-
117-
# FuseBox cache
118-
.fusebox/
119-
120-
# DynamoDB Local files
121-
.dynamodb/
70+
dist/
12271

12372
# TernJS port file
12473
.tern-port
@@ -138,7 +87,12 @@ yarn.lock
13887

13988
# Protobuf
14089
src/ProtobufMessage*
90+
proto/
14191

14292
.npmignore
14393

14494
package.json.tmpl
95+
96+
native.js
97+
native.d.ts
98+
native.js.map

node/jest.config.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ const config: Config = {
88
transformIgnorePatterns: [
99
"node_modules/",
1010
"\\.(js|jsx)$",
11-
"<rootDir>/build-js/",
11+
"<rootDir>/build-ts/",
1212
],
1313
testEnvironment: "node",
14+
// Look for tests inside the /tests/ directory with .test or .spec extensions
1415
testRegex: "/tests/.*\\.(test|spec)?\\.(ts|tsx)$",
15-
moduleFileExtensions: ["ts", "json", "node", "js"],
16-
modulePathIgnorePatterns: ["rust-client/"],
16+
moduleFileExtensions: ["ts", "js", "json", "node"],
17+
modulePathIgnorePatterns: ["rust-client/", "build-js/"],
18+
19+
// Reporters: default + HTML report
1720
reporters: [
1821
"default",
1922
[
20-
"./node_modules/jest-html-reporter",
23+
"jest-html-reporter",
2124
{
2225
includeFailureMsg: true,
2326
includeSuiteFailure: true,
@@ -26,7 +29,11 @@ const config: Config = {
2629
},
2730
],
2831
],
29-
setupFilesAfterEnv: ["./tests/setup.ts"],
32+
33+
// Setup file to configure the testing environment after Jest is installed
34+
setupFilesAfterEnv: ["<rootDir>/tests/setup.ts"],
35+
36+
// Coverage settings
3037
coverageProvider: "v8",
3138
collectCoverage: true,
3239
coverageReporters: ["text", "html"],

node/npm/glide/jest.config.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

node/tests/setup.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable no-var */
2-
import { beforeAll } from "@jest/globals";
2+
/// <reference types="jest" />
3+
import { afterEach, beforeAll } from "@jest/globals";
34
import minimist from "minimist";
45
import { Logger } from "../build-ts";
56

@@ -8,6 +9,12 @@ beforeAll(() => {
89
// Logger.setLoggerConfig("off");
910
});
1011

12+
// Clear all timers after each test to prevent hanging handles,
13+
// Hanging handles are often caused by setTimeout, setInterval, or similar functions that are not cleared properly. Meaning we create a timer which something is waiting for it to finish, whether the test or some code piece, and not clearing it led to the test hanging. Causing memory leaks and other issues.
14+
afterEach(() => {
15+
jest.clearAllTimers();
16+
});
17+
1118
declare global {
1219
var CLI_ARGS: Record<string, string | boolean | number>;
1320
var CLUSTER_ENDPOINTS: string;

utils/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
"author": "",
1313
"license": "Apache-2.0",
1414
"devDependencies": {
15-
"@types/node": "22.9",
16-
"@types/semver": "^7.5.8",
17-
"prettier": "^3.3"
15+
"@types/node": "22",
16+
"@types/semver": "^7",
17+
"prettier": "^3"
1818
},
1919
"dependencies": {
20-
"child_process": "^1.0.2",
21-
"semver": "^7.6.3",
22-
"typescript": "^5.4.5"
20+
"child_process": "^1",
21+
"semver": "^7",
22+
"typescript": "^5"
2323
}
2424
}

utils/release-candidate-testing/node/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
"type": "module",
77
"scripts": {
88
"test": "node index.js",
9-
"build-utils": "cd ../../ && npm run build",
9+
"build:utils": "cd ../../ && npm install && npm run build",
1010
"prettier:check:ci": "./node_modules/.bin/prettier --check .",
1111
"prettier:format": "./node_modules/.bin/prettier --write . "
1212
},
1313
"author": "",
1414
"license": "Apache-2.0",
1515
"dependencies": {
16-
"@valkey/valkey-glide": "latest"
16+
"@valkey/valkey-glide": "latest",
17+
"typescript": "^5"
1718
},
1819
"devDependencies": {
19-
"prettier": "^2.8.8"
20+
"prettier": "^3"
2021
}
2122
}

0 commit comments

Comments
 (0)