mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: Add --no-suggestion to custom test runner (#9598)
This commit is contained in:
parent
c5068ea2ec
commit
90ef8793ac
@ -38,9 +38,25 @@ npm test
|
|||||||
- **Important**: don't forget to first build the code if you're testing local changes:
|
- **Important**: don't forget to first build the code if you're testing local changes:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build && npm test
|
npm run build --workspace=@puppeteer-test/test && npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### CLI options
|
||||||
|
|
||||||
|
| Description | Option | Type |
|
||||||
|
| ----------------------------------------------------------------- | ---------------- | ------- |
|
||||||
|
| Do not generate coverage report | --no-coverage | boolean |
|
||||||
|
| Do not generate suggestion for updating TestExpectation.json file | --no-suggestions | boolean |
|
||||||
|
| Specify a file to which to save run data | --save-stats-to | string |
|
||||||
|
| Specify a file with a custom Mocha reporter | --reporter | string |
|
||||||
|
| Number of times to retry failed tests. | --retries | number |
|
||||||
|
| Timeout threshold value. | --timeout | number |
|
||||||
|
| Tell Mocha to not run test files in parallel | --no-parallel | boolean |
|
||||||
|
| Generate full stacktrace upon failure | --fullTrace | boolean |
|
||||||
|
| Name of the Test suit defined in TestSuites.json | --test-suite | string |
|
||||||
|
|
||||||
|
### Helpful information
|
||||||
|
|
||||||
- To run a specific test, substitute the `it` with `it.only`:
|
- To run a specific test, substitute the `it` with `it.only`:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
@ -71,6 +71,7 @@ function getApplicableTestSuites(
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const noCoverage = process.argv.indexOf('--no-coverage') !== -1;
|
const noCoverage = process.argv.indexOf('--no-coverage') !== -1;
|
||||||
|
const noSuggestions = process.argv.indexOf('--no-suggestions') !== -1;
|
||||||
|
|
||||||
const statsFilenameIdx = process.argv.indexOf('--save-stats-to');
|
const statsFilenameIdx = process.argv.indexOf('--save-stats-to');
|
||||||
let statsFilename = '';
|
let statsFilename = '';
|
||||||
@ -209,44 +210,46 @@ async function main() {
|
|||||||
fail = true;
|
fail = true;
|
||||||
console.error(err);
|
console.error(err);
|
||||||
} finally {
|
} finally {
|
||||||
const toAdd = recommendations.filter(item => {
|
if (!noSuggestions) {
|
||||||
return item.action === 'add';
|
const toAdd = recommendations.filter(item => {
|
||||||
});
|
return item.action === 'add';
|
||||||
if (toAdd.length) {
|
});
|
||||||
console.log(
|
if (toAdd.length) {
|
||||||
'Add the following to TestExpectations.json to ignore the error:'
|
console.log(
|
||||||
);
|
'Add the following to TestExpectations.json to ignore the error:'
|
||||||
prettyPrintJSON(
|
);
|
||||||
toAdd.map(item => {
|
prettyPrintJSON(
|
||||||
return item.expectation;
|
toAdd.map(item => {
|
||||||
})
|
return item.expectation;
|
||||||
);
|
})
|
||||||
}
|
);
|
||||||
const toRemove = recommendations.filter(item => {
|
}
|
||||||
return item.action === 'remove';
|
const toRemove = recommendations.filter(item => {
|
||||||
});
|
return item.action === 'remove';
|
||||||
if (toRemove.length) {
|
});
|
||||||
console.log(
|
if (toRemove.length) {
|
||||||
'Remove the following from the TestExpectations.json to ignore the error:'
|
console.log(
|
||||||
);
|
'Remove the following from the TestExpectations.json to ignore the error:'
|
||||||
prettyPrintJSON(
|
);
|
||||||
toRemove.map(item => {
|
prettyPrintJSON(
|
||||||
return item.expectation;
|
toRemove.map(item => {
|
||||||
})
|
return item.expectation;
|
||||||
);
|
})
|
||||||
}
|
);
|
||||||
const toUpdate = recommendations.filter(item => {
|
}
|
||||||
return item.action === 'update';
|
const toUpdate = recommendations.filter(item => {
|
||||||
});
|
return item.action === 'update';
|
||||||
if (toUpdate.length) {
|
});
|
||||||
console.log(
|
if (toUpdate.length) {
|
||||||
'Update the following expectations in the TestExpecations.json to ignore the error:'
|
console.log(
|
||||||
);
|
'Update the following expectations in the TestExpecations.json to ignore the error:'
|
||||||
prettyPrintJSON(
|
);
|
||||||
toUpdate.map(item => {
|
prettyPrintJSON(
|
||||||
return item.expectation;
|
toUpdate.map(item => {
|
||||||
})
|
return item.expectation;
|
||||||
);
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
process.exit(fail ? 1 : 0);
|
process.exit(fail ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user