Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit b369998

Browse files
committed
adde dev option to benchmarks
1 parent f0968b7 commit b369998

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,19 @@ The philosophy behind AgileTs is simple:
8888

8989
Write minimalistic, boilerplate-free code that captures your intent.
9090
```ts
91-
// Create State with inital value 'frank'
91+
// Create State with the inital value 'frank'
9292
const MY_STATE = createState('frank');
9393

94-
// Update State value from 'frank' to 'jeff'
94+
// Update the State value from 'frank' to 'jeff'
9595
MY_STATE.set('jeff');
9696

97-
// Undo latest State value change
97+
// Undo the latest State value change
9898
MY_STATE.undo();
9999

100-
// Reset State value to its initial value
100+
// Reset the State value to its initial value
101101
MY_STATE.reset();
102102

103-
// Permanently store State value in an external Storage
103+
// Permanently store the State value in an external Storage
104104
MY_STATE.persist("storage-key");
105105
```
106106

benchmark/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANUAL_BENCHMARK=false
1+
DEV=false

benchmark/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,18 @@ Execute the benchmark located in `./benchmarks/react/counter`.
121121
```ts
122122
yarn run test:counter
123123
```
124+
If you want to test it manually, enable the `dev mode`.
125+
```ts
126+
yarn run test:counter --dev
127+
```
128+
The difference to the 'normal' mode is that:
129+
- the executed bundle isn't `minified`
130+
- the test has to be started manually by opening `localhost:3003`
131+
- the test results are printed in the `browser console`
124132

125133
## ⭐️ Contribute
126134

127-
Get a part of AgileTs and start contributing. We welcome any meaningful contribution. 😀
135+
Feel free to add more tests and State Managers to be tested. We welcome any meaningful contribution. 😀
128136
To find out more about contributing, check out the [CONTRIBUTING.md](https://github.com/agile-ts/agile/blob/master/CONTRIBUTING.md).
129137

130138
<a href="https://codeclimate.com/github/agile-ts/agile/coverage.svg">

benchmark/run.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dotenv.config();
1010
// Extract entry (at third parameter) from the executed command
1111
// yarn run ./path/to/entry -> './path/to/entry' is extracted
1212
const entry = process.argv.slice(2)[0];
13+
const dev = process.argv.slice(2)[1] === '--dev' || process.env.DEV === 'true';
1314
if (entry == null) {
1415
throw new Error(
1516
"No valid entry was provided! Valid entry example: 'yarn run ./benchmarks/react/counter'"
@@ -34,7 +35,7 @@ const startBenchmark = async () => {
3435
target: 'es2015',
3536
format: 'cjs', // https://esbuild.github.io/api/#format-commonjs
3637
platform: 'browser',
37-
minify: true, // https://esbuild.github.io/api/#minify
38+
minify: !dev, // https://esbuild.github.io/api/#minify
3839
bundle: true, // https://esbuild.github.io/api/#bundle
3940
sourcemap: 'external', // https://esbuild.github.io/api/#sourcemap// https://github.com/evanw/esbuild/issues/69
4041
}
@@ -53,7 +54,12 @@ const startBenchmark = async () => {
5354
const page = await context.newPage();
5455

5556
// Option to open and test the Benchmark Test Suite in the browser manually
56-
if (process.env.MANUAL_BENCHMARK === 'true') {
57+
if (dev) {
58+
console.log(
59+
`${chalk.blue('[i]')} ${chalk.gray(
60+
`Development mode is ${chalk.green(`active`)}`
61+
)}`
62+
);
5763
console.log(
5864
`${chalk.blue('[i]')} ${chalk.gray(
5965
`Benchmark is running at ${chalk.blueBright.bold(serverUrl)}`

0 commit comments

Comments
 (0)