diff --git a/tracker/tracker-assist/.yarn/install-state.gz b/tracker/tracker-assist/.yarn/install-state.gz index 8a0902616..f17e3ac34 100644 Binary files a/tracker/tracker-assist/.yarn/install-state.gz and b/tracker/tracker-assist/.yarn/install-state.gz differ diff --git a/tracker/tracker-assist/package.json b/tracker/tracker-assist/package.json index e110c7100..8745f6126 100644 --- a/tracker/tracker-assist/package.json +++ b/tracker/tracker-assist/package.json @@ -38,17 +38,16 @@ }, "devDependencies": { "@openreplay/tracker": "file:../tracker", - "@typescript-eslint/eslint-plugin": "^5.30.0", - "@typescript-eslint/parser": "^5.30.0", - "eslint": "^7.8.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.2.1", - "jest": "^29.3.1", - "jest-environment-jsdom": "^29.3.1", - "lint-staged": "^13.0.3", - "prettier": "^2.7.1", + "@typescript-eslint/eslint-plugin": "^8.14.0", + "@typescript-eslint/parser": "^8.14.0", + "eslint": "^9.15.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "prettier": "^3.3.3", "replace-in-files-cli": "^1.0.0", - "ts-jest": "^29.0.3", + "ts-jest": "^29.2.5", "typescript": "^5.6.3" }, "lint-staged": { diff --git a/tracker/tracker/.yarn/install-state.gz b/tracker/tracker/.yarn/install-state.gz index 27000f6a5..fa46e2d7a 100644 Binary files a/tracker/tracker/.yarn/install-state.gz and b/tracker/tracker/.yarn/install-state.gz differ diff --git a/tracker/tracker/package.json b/tracker/tracker/package.json index d1ac4323c..a815ba4f7 100644 --- a/tracker/tracker/package.json +++ b/tracker/tracker/package.json @@ -43,26 +43,26 @@ "prepublishOnly": "bun run test && bun run build" }, "devDependencies": { - "@babel/core": "^7.10.2", - "@jest/globals": "^29.3.1", + "@babel/core": "^7.26.0", + "@jest/globals": "^29.7.0", "@rollup/plugin-babel": "^6.0.4", - "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-replace": "^6.0.1", "@rollup/plugin-terser": "0.4.4", "@rollup/plugin-typescript": "^12.1.1", - "@typescript-eslint/eslint-plugin": "^8.10.0", - "@typescript-eslint/parser": "^8.10.0", - "eslint": "^8.57.1", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-prettier": "^5.0.1", - "jest": "^29.3.1", - "jest-environment-jsdom": "^29.3.1", - "prettier": "^3.0.3", + "@typescript-eslint/eslint-plugin": "^8.14.0", + "@typescript-eslint/parser": "^8.14.0", + "eslint": "^9.15.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "prettier": "^3.3.3", "replace-in-files": "^2.0.3", - "rollup": "^4.1.4", + "rollup": "^4.27.2", "semver": "^6.3.0", - "ts-jest": "^29.0.3", - "tslib": "^2.8.0", + "ts-jest": "^29.2.5", + "tslib": "^2.8.1", "typescript": "^5.6.3" }, "dependencies": { diff --git a/tracker/tracker/src/tests/StringDictionary.unit.test.ts b/tracker/tracker/src/tests/StringDictionary.unit.test.ts index dfe742d51..6f40e7efe 100644 --- a/tracker/tracker/src/tests/StringDictionary.unit.test.ts +++ b/tracker/tracker/src/tests/StringDictionary.unit.test.ts @@ -3,7 +3,7 @@ import { StringDictionary } from '../main/modules/attributeSender.js' describe('StringDictionary', () => { test('key is non-zero', () => { - const dict = new StringDictionary() + const dict = new StringDictionary(() => 1) const [key, isNew] = dict.getKey('We are Asayer') @@ -12,7 +12,7 @@ describe('StringDictionary', () => { }) test('Different strings have different keys', () => { - const dict = new StringDictionary() + const dict = new StringDictionary(() => 1) const [key1, isNew1] = dict.getKey('Datadog') const [key2, isNew2] = dict.getKey('PostHog') @@ -22,7 +22,7 @@ describe('StringDictionary', () => { }) test('Similar strings have similar keys', () => { - const dict = new StringDictionary() + const dict = new StringDictionary(() => 1) const [key1, isNew1] = dict.getKey("What's up?") const [key2, isNew2] = dict.getKey("What's up?") diff --git a/tracker/tracker/src/tests/attributeSender.unit.test.ts b/tracker/tracker/src/tests/attributeSender.unit.test.ts index 0fc8f50be..47cb4184e 100644 --- a/tracker/tracker/src/tests/attributeSender.unit.test.ts +++ b/tracker/tracker/src/tests/attributeSender.unit.test.ts @@ -9,6 +9,9 @@ describe('AttributeSender', () => { beforeEach(() => { appMock = { send: (...args: any[]) => args, + session: { + getPageNumber: () => 1, + } } attributeSender = new AttributeSender({ app: appMock, @@ -23,10 +26,10 @@ describe('AttributeSender', () => { test('should send the set attribute message to the app', () => { const sendSpy = jest.spyOn(appMock, 'send') const id = 1 - const name = 'color' - const value = 'red' + const name = 'color' // 1_1 + const value = 'red' // attribute is second, so 1_2; (page_key) // @ts-ignore - const expectedMessage = [Type.SetNodeAttributeDict, id, 1, 2] + const expectedMessage = [Type.SetNodeAttributeDict, id, '1_1', '1_2'] attributeSender.sendSetAttribute(id, name, value) @@ -54,14 +57,14 @@ describe('AttributeSender', () => { test('should send the string dictionary entry if the attribute is new', () => { const id = 1 - const name = 'color' + const name = 'color' // 1_1, name comes first (page_keyid) const value = 'red' const sendSpy = jest.spyOn(appMock, 'send') attributeSender.sendSetAttribute(id, name, value) // @ts-ignore - expect(sendSpy).toHaveBeenCalledWith([Type.StringDict, expect.any(Number), name]) + expect(sendSpy).toHaveBeenCalledWith([Type.StringDict, '1_1', name]) }) test('should not send the string dictionary entry if the attribute already exists', () => { diff --git a/tracker/tracker/tsconfig-base.json b/tracker/tracker/tsconfig-base.json index 8379b4f1d..1a48551d5 100644 --- a/tracker/tracker/tsconfig-base.json +++ b/tracker/tracker/tsconfig-base.json @@ -6,11 +6,12 @@ "strictNullChecks": true, "alwaysStrict": true, "target": "es2020", + "lib": ["DOM", "ES2020"], "module": "NodeNext", "moduleResolution": "NodeNext", "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "resolveJsonModule": true, + "resolveJsonModule": true }, "exclude": ["**/*.test.ts"], }