Skip to content

Commit 12a90b6

Browse files
committed
fix test tsconfig and jest config
test more test remove duplicated `globals` entry in jest.config after rebase add `__DEBUG_BUILD__`
1 parent f566993 commit 12a90b6

File tree

5 files changed

+31
-11
lines changed

5 files changed

+31
-11
lines changed

packages/replay/jest.config.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import type { Config } from '@jest/types';
22
import { pathsToModuleNameMapper } from 'ts-jest';
3+
import { jsWithTs as jsWithTsPreset } from 'ts-jest/presets';
34

4-
import { compilerOptions } from './tsconfig.json';
5+
import { compilerOptions } from './tsconfig.test.json';
56

67
export default async (): Promise<Config.InitialOptions> => {
78
return {
9+
...jsWithTsPreset,
810
verbose: true,
9-
preset: 'ts-jest/presets/js-with-ts', // needed when import worker.js
11+
globals: {
12+
'ts-jest': {
13+
tsconfig: '<rootDir>/tsconfig.test.json',
14+
},
15+
__DEBUG_BUILD__: true,
16+
},
1017
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
1118
prefix: '<rootDir>/',
1219
}),
1320
setupFilesAfterEnv: ['./jest.setup.ts'],
1421
testEnvironment: 'jsdom',
1522
testMatch: ['<rootDir>/test/**/*(*.)@(spec|test).ts'],
16-
globals: {
17-
'ts-jest': {
18-
tsconfig: '<rootDir>/tsconfig.json',
19-
},
20-
__DEBUG_BUILD__: true,
21-
},
2223
};
2324
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/replay/test/unit/util/isSampled.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { isSampled } from '../../../src/util/isSampled';
22

33
// Note Math.random generates a value from 0 (inclusive) to <1 (1 exclusive).
4-
const cases = [
4+
const cases: [number, number, boolean][] = [
55
[1.0, 0.9999, true],
66
[1.0, 0.0, true],
77
[1.0, 0.5, true],

packages/replay/tsconfig.test.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
"include": ["test/**/*.ts", "jest.config.ts", "jest.setup.ts"],
55

66
"compilerOptions": {
7-
"types": ["node", "jest"]
7+
"paths": {
8+
"@test": ["./test"],
9+
"@test/*": ["./test/*"]
10+
},
11+
"baseUrl": ".",
12+
"rootDir": ".",
13+
"types": ["node", "jest"],
14+
"noImplicitAny": false,
15+
"noImplicitThis": false,
16+
"strictPropertyInitialization": false,
17+
"resolveJsonModule": true,
18+
"allowJs": true
819
}
920
}

packages/replay/worker/src/Compressor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class Compressor {
99
/**
1010
* Number of added events
1111
*/
12-
public added: number;
12+
public added: number = 0;
1313

1414
public constructor() {
1515
this.init();

0 commit comments

Comments
 (0)