Skip to content

Commit

Permalink
apply recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinmombay committed Feb 25, 2021
1 parent 8f55e1b commit 101cffc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
21 changes: 7 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,9 @@ jobs:
- setup_vm
- install_chrome
- run:
name: 'Visual Diff Tests (using << parameters.build_type >> build)'
command: node build-system/pr-check/visual-diff-tests.js --type << parameters.build_type >>
name: 'Visual Diff Tests'
command: node build-system/pr-check/visual-diff-tests.js
- fail_fast
parameters:
build_type:
description: 'Which build type to use'
type: string
enum: ['module', 'nomodule']
'Unit Tests':
executor:
name: amphtml-large-executor
Expand Down Expand Up @@ -198,7 +193,7 @@ jobs:
- restore_karma_cache:
cache_name: nomodule
- run:
name: 'Nomodule Tests (using << parameters.config >>-config.json)'
name: 'Nomodule Tests (<< parameters.config >>-config.json)'
command: node build-system/pr-check/nomodule-tests.js
- save_karma_cache:
cache_name: nomodule
Expand All @@ -219,7 +214,7 @@ jobs:
- restore_karma_cache:
cache_name: module
- run:
name: 'Module Tests (using << parameters.config >>-config.json)'
name: 'Module Tests (<< parameters.config >>-config.json)'
command: node build-system/pr-check/module-tests.js
- save_karma_cache:
cache_name: module
Expand Down Expand Up @@ -333,13 +328,11 @@ workflows:
- 'Validator Tests':
<<: *push_and_pr_builds
- 'Visual Diff Tests':
name: 'Visual Diff Tests (<< matrix.build_type >>)'
matrix:
parameters:
build_type: ['module', 'nomodule']
<<: *push_and_pr_builds
name: 'Visual Diff Tests'
requires:
- 'Module Build'
- 'Nomodule Build'
<<: *push_and_pr_builds
- 'Unit Tests':
<<: *push_and_pr_builds
- 'Unminified Tests':
Expand Down
14 changes: 6 additions & 8 deletions build-system/pr-check/visual-diff-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* @fileoverview Script that runs the visual diff tests during CI.
*/

const argv = require('minimist')(process.argv.slice(2));
const atob = require('atob');
const {
downloadNomoduleOutput,
Expand All @@ -31,26 +30,25 @@ const {runCiJob} = require('./ci-job');

const jobName = 'visual-diff-tests.js';

let baseCommand = 'gulp visual-diff';
if (argv.type === 'module') {
baseCommand += ' --esm';
}
const baseCommand = 'gulp visual-diff';

function pushBuildWorkflow() {
downloadNomoduleOutput();
timedExecOrDie('gulp update-packages');
process.env['PERCY_TOKEN'] = atob(process.env.PERCY_TOKEN_ENCODED);
timedExecOrDie(`gulp visual-diff --nobuild --master${esmFlag}`);
timedExecOrDie(`${baseCommand} --nobuild --master`);
}

function prBuildWorkflow() {
process.env['PERCY_TOKEN'] = atob(process.env.PERCY_TOKEN_ENCODED);
if (buildTargetsInclude(Targets.RUNTIME, Targets.VISUAL_DIFF)) {
downloadNomoduleOutput();
timedExecOrDie('gulp update-packages');
timedExecOrDie(`gulp visual-diff --nobuild${esmFlag}`);
timedExecOrDie(`${baseCommand} --nobuild --esm`);
timedExecOrDie(`${baseCommand} --nobuild`);
} else {
timedExecOrDie(`gulp visual-diff --empty${esmFlag}`);
timedExecOrDie(`${baseCommand} --empty --esm`);
timedExecOrDie(`${baseCommand} --empty`);
printSkipMessage(
jobName,
'this PR does not affect the runtime or visual diff tests'
Expand Down
4 changes: 2 additions & 2 deletions build-system/tasks/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ async function stopServer() {

/**
* Closes the existing server and restarts it
* @param {?serverOptionsDef} serverOptions
* @param {ServerOptionsDef=} serverOptions
*/
async function restartServer(serverOptions = {}) {
stopServer();
Expand Down Expand Up @@ -226,7 +226,7 @@ async function serve() {

/**
* Starts a webserver at the repository root to serve built files.
* @param {?ServerOptionsDef} serverOptions
* @param {ServerOptionsDef=} serverOptions
*/
async function doServe(serverOptions = {}) {
createCtrlcHandler('serve');
Expand Down
1 change: 1 addition & 0 deletions build-system/tasks/visual-diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ async function generateSnapshots(webpages) {
// no interactions, and each test that has in interactive tests file should
// load those tests here.
for (const webpage of webpages) {
webpage.name += argv.esm ? ' (Module)' : ' (Nomodule)';
webpage.tests_ = {};
if (!webpage.no_base_test) {
webpage.tests_[''] = async () => {};
Expand Down

0 comments on commit 101cffc

Please sign in to comment.