Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(perf): add benchmark for jest runner (#2618)
* Add a git submodule for https://github.com/GoogleChrome/lighthouse, a big open source project that uses jest * Add functionality to run performance tests without installing stryker explicitly in the project * Add functionality to install dependencies with `yarn` instead of `npm` (used for lighthouse)
- Loading branch information
Showing
14 changed files
with
1,548 additions
and
1,436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "perf/test/express"] | ||
path = perf/test/express | ||
url = https://github.com/expressjs/express.git | ||
[submodule "perf/test/lighthouse"] | ||
path = perf/test/lighthouse | ||
url = https://github.com/GoogleChrome/lighthouse.git |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"$schema": "../../../packages/core/schema/stryker-schema.json", | ||
"packageManager": "yarn", | ||
"reporters": [ | ||
"html", | ||
"clear-text", | ||
"progress", | ||
"json" | ||
], | ||
"jest": { | ||
"config": { | ||
"testMatch": ["**/lighthouse-core/test/audits/**/*-test.js"], | ||
"setupFilesAfterEnv": ["./lighthouse-core/test/test-utils.js"], | ||
"testEnvironment": "node", | ||
"transform": {}, | ||
"collectCoverage": false | ||
} | ||
}, | ||
"mutate": [ | ||
"lighthouse-core/audits/**/*.js" | ||
], | ||
"testRunner": "jest", | ||
"coverageAnalysis": "off" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as fs from 'fs'; | ||
import * as minimatch from 'minimatch'; | ||
import * as path from 'path'; | ||
import * as execa from 'execa'; | ||
|
||
const testRootDir = path.resolve(__dirname, '..', 'test'); | ||
|
||
installAll() | ||
.then(() => console.log('Done')) | ||
.catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
|
||
/** | ||
* Installs all packages under the "test" directory, while respecting their preferred package manager (yarn vs npm 🙄) | ||
*/ | ||
async function installAll() { | ||
const globPattern = process.env.PERF_TEST_GLOB_PATTERN || '*'; | ||
const testDirs = fs.readdirSync(testRootDir).filter((testDir) => minimatch(testDir, globPattern)); | ||
if (testDirs.length) { | ||
console.log(`Installing ${testDirs.join(', ')} (matched with glob pattern "${globPattern}")`); | ||
} else { | ||
console.warn(`No tests match glob expression ${globPattern}`); | ||
} | ||
await Promise.all(testDirs.map(install)); | ||
} | ||
|
||
async function install(testDir: string) { | ||
const strykerConfig = require(`../test/${testDir}/stryker.conf`); | ||
const packageManager: string | undefined = strykerConfig.packageManager; | ||
let command = 'npm'; | ||
let args: string[] = []; | ||
if (packageManager === 'yarn') { | ||
command = 'yarn'; | ||
args.push('install', '--frozen-lockfile'); | ||
} else if(fs.existsSync(path.resolve(testRootDir, testDir, 'package-lock.json'))) { | ||
args.push('ci'); | ||
} else { | ||
args.push('install'); | ||
} | ||
console.log(`[${testDir}] ${command} ${args.join(' ')}`); | ||
await execa(command, args, { cwd: path.resolve(testRootDir, testDir) }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.