Skip to content

Commit

Permalink
renamed perf + tests to benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova committed Oct 8, 2020
1 parent e43ff18 commit 500cfa2
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion test/perf/debug.html → benchmark/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="root"></div>
<script src="../../tmp/tests.js"></script>
<script src="../../tmp/benchmark.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions benchmark/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom';

// Get all the scenarios
const requirePerfScenarios = require.context('./scenarios', true, /(js|ts|tsx)$/);

const rootEl = document.getElementById('root');

const scenarioSuitePath = window.location.search.replace('?', '');

const Component = requirePerfScenarios(scenarioSuitePath).default;

ReactDOM.render(<Component />, rootEl);
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/perf/webpack.config.js → benchmark/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const path = require('path');
const webpackBaseConfig = require('../../webpackBaseConfig');
const webpackBaseConfig = require('../webpackBaseConfig');

module.exports = {
...webpackBaseConfig,
entry: path.resolve(__dirname, 'index.js'),
mode: 'development',
output: {
path: path.resolve(__dirname, '../../tmp'),
filename: 'tests.js',
path: path.resolve(__dirname, '../tmp'),
filename: 'benchmark.js',
},
module: {
...webpackBaseConfig.module,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"proptypes": "cross-env BABEL_ENV=test babel-node --extensions \".tsx,.ts,.js\" ./scripts/generateProptypes.ts",
"deduplicate": "node scripts/deduplicate.js",
"argos": "argos upload test/regressions/screenshots/chrome --token $ARGOS_TOKEN",
"benchmark": "yarn webpack --config benchmark/webpack.config.js --mode \"production\" && node scripts/benchmark.js",
"build:codesandbox": "lerna run --parallel --scope \"@material-ui/*\" build",
"docs:api": "rimraf ./docs/pages/api-docs && yarn docs:api:build",
"docs:api:build": "cross-env BABEL_ENV=test __NEXT_EXPORT_TRAILING_SLASH=true babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/buildApi.ts ./docs/pages/api-docs ./packages/material-ui/src ./packages/material-ui-lab/src",
Expand All @@ -27,7 +28,6 @@
"jsonlint": "node scripts/jsonlint.js",
"lint": "eslint . --cache --report-unused-disable-directives --ext .js,.ts,.tsx",
"lint:ci": "eslint . --report-unused-disable-directives --ext .js,.ts,.tsx",
"perf": "yarn webpack --config test/perf/webpack.config.js --mode \"production\" && node scripts/perf.js",
"prettier": "node ./scripts/prettier.js",
"prettier:all": "node ./scripts/prettier.js write",
"size:snapshot": "node scripts/sizeSnapshot/create",
Expand Down
6 changes: 3 additions & 3 deletions scripts/perf.js → scripts/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const http = require('http');

const SERVER = 'localhost';
const PORT = 1122;
const APP = 'test/perf/debug';
const APP = 'benchmark';

http
.createServer((request, response) => {
Expand Down Expand Up @@ -41,12 +41,12 @@ async function runMeasures(browser, testCase, times) {
for (let i = 0; i < times; i += 1) {
const { page, close } = await browser.openPage(`http://${SERVER}:${PORT}/${APP}?${testCase}`);

const perf = await page.evaluate(() => {
const benchmark = await page.evaluate(() => {
const { loadEventEnd, navigationStart } = performance.timing;
return loadEventEnd - navigationStart;
});

measures.push(perf);
measures.push(benchmark);
await close();
}

Expand Down
16 changes: 0 additions & 16 deletions test/perf/index.js

This file was deleted.

0 comments on commit 500cfa2

Please sign in to comment.