From f9cd9de1003bf7e70b42c793dacb95ccc68a0a78 Mon Sep 17 00:00:00 2001 From: ylemkimon Date: Mon, 3 Aug 2020 06:58:40 +0900 Subject: [PATCH] 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 --- .circleci/config.yml | 19 ++++--------------- test/screenshotter-spec.js | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 test/screenshotter-spec.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 421afc1d..242b2634 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/test/screenshotter-spec.js b/test/screenshotter-spec.js new file mode 100644 index 00000000..b3ad61ad --- /dev/null +++ b/test/screenshotter-spec.js @@ -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 + }); + }); + } + } +});