Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] [tests] fix tests on master #1366

Closed
wants to merge 12 commits into from
2 changes: 2 additions & 0 deletions .changeset/real-windows-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"test:update": "yarn turbo run test:update",
"format": "yarn prettier --write '**/*.{ts,md}'",
"dev": "yarn turbo run dev",
"check-types": "yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references --check' 'yarn turbo run check-types'",
"repl": "cd packages/rrweb && npm run repl",
"live-stream": "cd packages/rrweb && yarn live-stream",
"lint": "yarn run concurrently --success=all -r -m=1 'yarn run markdownlint docs' 'yarn eslint packages/*/src --ext .ts,.tsx,.js,.jsx,.svelte'",
Expand Down
12 changes: 11 additions & 1 deletion packages/rrdom/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
export default {
preset: 'ts-jest',
testEnvironment: 'node',
setupFiles: ['./jest.setup.ts'],
/**
* Keeps old (pre-jest 29) snapshot format
* its a bit ugly and harder to read than the new format,
* so we might want to remove this in its own PR
*/
snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
};
3 changes: 3 additions & 0 deletions packages/rrdom/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { TextEncoder, TextDecoder } from 'util';

Object.assign(global, { TextDecoder, TextEncoder });
16 changes: 9 additions & 7 deletions packages/rrdom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,24 @@
"url": "https://github.com/rrweb-io/rrweb/issues"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^20.0.0",
"@rrweb/types": "^2.0.0-alpha.11",
"@types/jest": "^27.4.1",
"@rollup/plugin-commonjs": "^25.0.0",
"@types/jest": "^29.5.10",
"@types/puppeteer": "^5.4.4",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.23.0",
"eslint": "^8.15.0",
"jest": "^27.5.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"puppeteer": "^17.1.3",
"rollup": "^2.56.3",
"rollup": "^2.79.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"rollup-plugin-typescript2": "^0.36.0",
"rollup-plugin-web-worker-loader": "^1.6.1",
"ts-jest": "^27.1.3"
"ts-jest": "^29.1.1",
"typescript": "^4.9.0"
},
"dependencies": {
"@rrweb/types": "^2.0.0-alpha.11",
"rrweb-snapshot": "^2.0.0-alpha.11"
}
}
12 changes: 11 additions & 1 deletion packages/rrweb-snapshot/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
export default {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/**.test.ts'],
setupFiles: ['./jest.setup.ts'],
/**
* Keeps old (pre-jest 29) snapshot format
* its a bit ugly and harder to read than the new format,
* so we might want to remove this in its own PR
*/
snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
};
3 changes: 3 additions & 0 deletions packages/rrweb-snapshot/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { TextEncoder, TextDecoder } from 'util';

Object.assign(global, { TextDecoder, TextEncoder });
23 changes: 13 additions & 10 deletions packages/rrweb-snapshot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"test:update": "jest --updateSnapshot",
"bundle": "rollup --config",
"bundle:es-only": "cross-env ES_ONLY=true rollup --config",
"dev": "yarn bundle:es-only --watch",
"typings": "tsc -d --declarationDir typings",
"dev": "yarn bundle:es-only --watch & yarn typings -w",
"check-types": "tsc --noEmit",
"typings": "tsc -d --declarationDir typings --emitDeclarationOnly",
"prepublish": "yarn typings && yarn bundle",
"lint": "yarn eslint src"
},
Expand Down Expand Up @@ -44,20 +45,22 @@
"homepage": "https://github.com/rrweb-io/rrweb/tree/master/packages/rrweb-snapshot#readme",
"devDependencies": {
"@types/chai": "^4.1.4",
"@types/jest": "^27.0.2",
"@types/jsdom": "^20.0.0",
"@types/jest": "^29.5.10",
"@types/jsdom": "^21.1.6",
"@types/node": "^18.15.11",
"@types/puppeteer": "^1.12.4",
"cross-env": "^5.2.0",
"jest": "^27.2.4",
"jest": "^29.7.0",
"jest-snapshot": "^23.6.0",
"jsdom": "^16.4.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^23.0.0",
"puppeteer": "^17.1.3",
"rollup": "^2.45.2",
"rollup": "^2.79.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"ts-jest": "^27.0.5",
"rollup-plugin-typescript2": "^0.36.0",
"ts-jest": "^29.1.1",
"ts-node": "^7.0.1",
"tslib": "^1.9.3"
"tslib": "^2.5.3",
"typescript": "^4.7.3"
}
}
12 changes: 7 additions & 5 deletions packages/rrweb-snapshot/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import * as http from 'http';
import * as url from 'url';
import * as puppeteer from 'puppeteer';
import * as rollup from 'rollup';
import * as typescript from 'rollup-plugin-typescript2';
import * as assert from 'assert';
import resolve from '@rollup/plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import assert from 'assert';
import { waitForRAF } from './utils';

const _resolve = resolve as unknown as () => rollup.Plugin;
const _typescript = typescript as unknown as () => rollup.Plugin;

const htmlFolder = path.join(__dirname, 'html');
Expand Down Expand Up @@ -74,7 +76,7 @@ describe('integration tests', function (this: ISuite) {

const bundle = await rollup.rollup({
input: path.resolve(__dirname, '../src/index.ts'),
plugins: [_typescript()],
plugins: [_resolve(), _typescript()],
});
const {
output: [{ code: _code }],
Expand Down Expand Up @@ -341,7 +343,7 @@ describe('iframe integration tests', function (this: ISuite) {

const bundle = await rollup.rollup({
input: path.resolve(__dirname, '../src/index.ts'),
plugins: [_typescript()],
plugins: [_resolve(), _typescript()],
});
const {
output: [{ code: _code }],
Expand Down Expand Up @@ -389,7 +391,7 @@ describe('shadow DOM integration tests', function (this: ISuite) {

const bundle = await rollup.rollup({
input: path.resolve(__dirname, '../src/index.ts'),
plugins: [_typescript()],
plugins: [_resolve(), _typescript()],
});
const {
output: [{ code: _code }],
Expand Down
1 change: 1 addition & 0 deletions packages/rrweb-snapshot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "ESNext",
"target": "ES6",
"moduleResolution": "Node",
"esModuleInterop": true,
"noImplicitAny": true,
"strictNullChecks": true,
"removeComments": true,
Expand Down
Loading
Loading