Skip to content

Commit 325a9f0

Browse files
eoghanmurrayJuice10YunFeng0817
authored
Update test commands (#1205)
* As per @yun Feng: everyone has npm installed globally but maybe not yarn * Add command to enable test result updating * Default to running tests HEADLESS on rrweb * Add command to build:all in a low memory environment * Add a 'retest' command for when the code hasn't changed, but you are working on the test cases * Add commands to reformat according to prettier. Named 'reformat' to indicate that we are doing a `--write` * Update package.json Co-authored-by: Yun Feng <[email protected]> * Apply suggestions from code review Co-authored-by: Yun Feng <[email protected]> * Create few-turkeys-reflect.md * Apply formatting changes --------- Co-authored-by: Justin Halsall <[email protected]> Co-authored-by: Yun Feng <[email protected]>
1 parent d7c72bf commit 325a9f0

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

.changeset/few-turkeys-reflect.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ Since we want the record and replay sides to share a strongly typed data structu
6464
2. Run `yarn install` in the root to install required dependencies for all sub-packages (note: `npm install` is _not_ recommended).
6565
3. Run `yarn dev` in the root to get auto-building for all the sub-packages whenever you modify anything.
6666
4. Navigate to one of the sub-packages (in the `packages` folder) where you'd like to make a change.
67-
5. Patch the code and run `yarn test` to run the tests, make sure they pass before you commit anything.
68-
6. Push the code and create a pull request.
67+
5. Patch the code and run `yarn test` to run the tests, make sure they pass before you commit anything. Add test cases in order to avoid future regression.
68+
6. If tests are failing, but the change in output is desirable, run `yarn test:update` and carefully commit the changes in test output.
69+
7. Push the code and create a pull request.
6970

7071
Protip: You can run `yarn test` in the root folder to run all the tests.
7172

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@
3636
"typescript": "^4.7.3"
3737
},
3838
"scripts": {
39-
"build:all": "yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references' 'yarn turbo run prepublish'",
39+
"build:all": "NODE_OPTIONS='--max-old-space-size=4096' yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references' 'yarn turbo run prepublish'",
4040
"test": "yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references --check' 'yarn turbo run test'",
4141
"test:watch": "yarn turbo run test:watch",
42+
"test:update": "yarn turbo run test:update",
43+
"format": "yarn prettier --write '**/*.{ts,md}'",
4244
"dev": "yarn turbo run dev",
4345
"repl": "cd packages/rrweb && npm run repl",
4446
"live-stream": "cd packages/rrweb && yarn live-stream",

packages/rrweb-snapshot/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
"prepack": "npm run bundle && npm run typings",
88
"test": "jest",
99
"test:watch": "jest --watch",
10+
"test:update": "jest --updateSnapshot",
1011
"bundle": "rollup --config",
1112
"bundle:es-only": "cross-env ES_ONLY=true rollup --config",
1213
"dev": "yarn bundle:es-only --watch",
1314
"typings": "tsc -d --declarationDir typings",
14-
"prepublish": "npm run typings && npm run bundle",
15+
"prepublish": "yarn typings && yarn bundle",
1516
"lint": "yarn eslint src"
1617
},
1718
"type": "module",

packages/rrweb/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
"scripts": {
66
"prepare": "npm run prepack",
77
"prepack": "npm run bundle",
8-
"test": "npm run bundle:browser && jest --testPathIgnorePatterns test/benchmark",
9-
"test:headless": "PUPPETEER_HEADLESS=true npm run test",
10-
"test:watch": "PUPPETEER_HEADLESS=true npm run test -- --watch",
11-
"repl": "npm run bundle:browser && node scripts/repl.js",
8+
"retest": "jest --testPathIgnorePatterns test/benchmark",
9+
"build-and-test": "yarn bundle:browser && yarn retest",
10+
"test:headless": "PUPPETEER_HEADLESS=true yarn build-and-test",
11+
"test:headful": "PUPPETEER_HEADLESS=false yarn build-and-test",
12+
"test": "yarn test:headless",
13+
"test:watch": "yarn test:headless -- --watch",
14+
"test:update": "yarn test:headless -- --updateSnapshot",
15+
"repl": "yarn bundle:browser && node scripts/repl.js",
1216
"live-stream": "yarn bundle:browser && node scripts/stream.js",
1317
"dev": "yarn bundle:browser --watch",
1418
"bundle:browser": "cross-env BROWSER_ONLY=true rollup --config",

turbo.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"test:watch": {
1111
"persistent": true
1212
},
13+
"test:update": {},
1314
"dev": {
1415
"dependsOn": ["^prepublish"],
1516
"persistent": true

0 commit comments

Comments
 (0)