tracker: update deps, fix tests, fix default lib for ts

This commit is contained in:
nick-delirium 2024-11-18 16:36:53 +01:00
parent db38f914a8
commit a538546d62
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
7 changed files with 36 additions and 33 deletions

View file

@ -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": {

View file

@ -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": {

View file

@ -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?")

View file

@ -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', () => {

View file

@ -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"],
}