mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
test(screenshotter): move coverage to Jest (#2324)
* Move screenshotter coverage collection to Jest testing Fixes #1885. * Update screenshotter-spec.js * Update screenshotter-spec.js Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
This commit is contained in:
@@ -43,16 +43,6 @@ commands:
|
||||
paths:
|
||||
- node_modules
|
||||
|
||||
codecov:
|
||||
parameters:
|
||||
flag:
|
||||
type: string
|
||||
steps:
|
||||
- run:
|
||||
name: Upload code coverage reports to Codecov
|
||||
# do not upload if screenshotter tests are skipped
|
||||
command: ./node_modules/.bin/codecov -F "<< parameters.flag >>"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
docker:
|
||||
@@ -81,8 +71,9 @@ jobs:
|
||||
command: |
|
||||
yarn test:flow
|
||||
yarn test:jest --coverage --runInBand
|
||||
- codecov:
|
||||
flag: test
|
||||
- run:
|
||||
name: Upload code coverage reports to Codecov
|
||||
command: ./node_modules/.bin/codecov
|
||||
|
||||
screenshotter:
|
||||
parameters:
|
||||
@@ -97,9 +88,7 @@ jobs:
|
||||
|
||||
- run:
|
||||
name: Verify screenshots and generate diffs and new screenshots
|
||||
command: node dockers/screenshotter/screenshotter.js --selenium-ip localhost -b $CIRCLE_JOB --verify --diff --new --coverage
|
||||
- codecov:
|
||||
flag: screenshotter
|
||||
command: node dockers/screenshotter/screenshotter.js --selenium-ip localhost -b $CIRCLE_JOB --verify --diff --new
|
||||
- store_artifacts:
|
||||
path: test/screenshotter/new
|
||||
destination: new
|
||||
|
19
test/screenshotter-spec.js
Normal file
19
test/screenshotter-spec.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const data = require("./screenshotter/ss_data");
|
||||
|
||||
describe("Screenshotter item", function() {
|
||||
for (const key in data) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
const item = data[key];
|
||||
it(`"${item.tex}" should build successfully`, function() {
|
||||
expect(item.tex).toBuild({
|
||||
macros: item.macros,
|
||||
displayMode: item.display,
|
||||
throwOnError: !item.noThrow,
|
||||
errorColor: item.errorColor,
|
||||
strict: false,
|
||||
trust: true, // trust test inputs
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user