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 <yun.feng0817@gmail.com>

* Apply suggestions from code review

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>

* Create few-turkeys-reflect.md

* Apply formatting changes

---------

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
This commit is contained in:
Eoghan Murray
2023-06-02 11:19:35 +01:00
committed by GitHub
parent d7c72bff07
commit 325a9f093e
6 changed files with 19 additions and 8 deletions

View File

@@ -0,0 +1,2 @@
---
---

View File

@@ -64,8 +64,9 @@ Since we want the record and replay sides to share a strongly typed data structu
2. Run `yarn install` in the root to install required dependencies for all sub-packages (note: `npm install` is _not_ recommended). 2. Run `yarn install` in the root to install required dependencies for all sub-packages (note: `npm install` is _not_ recommended).
3. Run `yarn dev` in the root to get auto-building for all the sub-packages whenever you modify anything. 3. Run `yarn dev` in the root to get auto-building for all the sub-packages whenever you modify anything.
4. Navigate to one of the sub-packages (in the `packages` folder) where you'd like to make a change. 4. Navigate to one of the sub-packages (in the `packages` folder) where you'd like to make a change.
5. Patch the code and run `yarn test` to run the tests, make sure they pass before you commit anything. 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.
6. Push the code and create a pull request. 6. If tests are failing, but the change in output is desirable, run `yarn test:update` and carefully commit the changes in test output.
7. Push the code and create a pull request.
Protip: You can run `yarn test` in the root folder to run all the tests. Protip: You can run `yarn test` in the root folder to run all the tests.

View File

@@ -36,9 +36,11 @@
"typescript": "^4.7.3" "typescript": "^4.7.3"
}, },
"scripts": { "scripts": {
"build:all": "yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references' 'yarn turbo run prepublish'", "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'",
"test": "yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references --check' 'yarn turbo run test'", "test": "yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references --check' 'yarn turbo run test'",
"test:watch": "yarn turbo run test:watch", "test:watch": "yarn turbo run test:watch",
"test:update": "yarn turbo run test:update",
"format": "yarn prettier --write '**/*.{ts,md}'",
"dev": "yarn turbo run dev", "dev": "yarn turbo run dev",
"repl": "cd packages/rrweb && npm run repl", "repl": "cd packages/rrweb && npm run repl",
"live-stream": "cd packages/rrweb && yarn live-stream", "live-stream": "cd packages/rrweb && yarn live-stream",

View File

@@ -7,11 +7,12 @@
"prepack": "npm run bundle && npm run typings", "prepack": "npm run bundle && npm run typings",
"test": "jest", "test": "jest",
"test:watch": "jest --watch", "test:watch": "jest --watch",
"test:update": "jest --updateSnapshot",
"bundle": "rollup --config", "bundle": "rollup --config",
"bundle:es-only": "cross-env ES_ONLY=true rollup --config", "bundle:es-only": "cross-env ES_ONLY=true rollup --config",
"dev": "yarn bundle:es-only --watch", "dev": "yarn bundle:es-only --watch",
"typings": "tsc -d --declarationDir typings", "typings": "tsc -d --declarationDir typings",
"prepublish": "npm run typings && npm run bundle", "prepublish": "yarn typings && yarn bundle",
"lint": "yarn eslint src" "lint": "yarn eslint src"
}, },
"type": "module", "type": "module",

View File

@@ -5,10 +5,14 @@
"scripts": { "scripts": {
"prepare": "npm run prepack", "prepare": "npm run prepack",
"prepack": "npm run bundle", "prepack": "npm run bundle",
"test": "npm run bundle:browser && jest --testPathIgnorePatterns test/benchmark", "retest": "jest --testPathIgnorePatterns test/benchmark",
"test:headless": "PUPPETEER_HEADLESS=true npm run test", "build-and-test": "yarn bundle:browser && yarn retest",
"test:watch": "PUPPETEER_HEADLESS=true npm run test -- --watch", "test:headless": "PUPPETEER_HEADLESS=true yarn build-and-test",
"repl": "npm run bundle:browser && node scripts/repl.js", "test:headful": "PUPPETEER_HEADLESS=false yarn build-and-test",
"test": "yarn test:headless",
"test:watch": "yarn test:headless -- --watch",
"test:update": "yarn test:headless -- --updateSnapshot",
"repl": "yarn bundle:browser && node scripts/repl.js",
"live-stream": "yarn bundle:browser && node scripts/stream.js", "live-stream": "yarn bundle:browser && node scripts/stream.js",
"dev": "yarn bundle:browser --watch", "dev": "yarn bundle:browser --watch",
"bundle:browser": "cross-env BROWSER_ONLY=true rollup --config", "bundle:browser": "cross-env BROWSER_ONLY=true rollup --config",

View File

@@ -10,6 +10,7 @@
"test:watch": { "test:watch": {
"persistent": true "persistent": true
}, },
"test:update": {},
"dev": { "dev": {
"dependsOn": ["^prepublish"], "dependsOn": ["^prepublish"],
"persistent": true "persistent": true