зеркало из https://github.com/golang/pkgsite.git
tests/e2e: update jest environment settings
Usage of GO_DISCOVERY_E2E_ENVIRONMENT is updated so that if it is set to "staging" or "prod", then the staging snapshots are used. Otherwise, the ci snapshots are used. A license header is add to tests/e2e/snapshotResolver.js and comments are added for future readers. Change-Id: Ib9d0ba2032b27479b3ecab93347fdfb939bd2aee Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/341109 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
This commit is contained in:
Родитель
aeecf376a7
Коммит
d880e524a0
|
@ -17,11 +17,16 @@ let config = {
|
|||
testPathIgnorePatterns: ['tests/e2e'],
|
||||
};
|
||||
|
||||
// When GO_DISCOVERY_E2E_ENVIRONMENT is not set to staging or prod, use the
|
||||
// snapshots in tests/e2e/__snapshots__/ci. Otherwise, use
|
||||
// tests/e2e/__snapshots__/staging. Data in staging and prod are always expected
|
||||
// to be the same.
|
||||
//
|
||||
// eslint-disable-next-line no-undef
|
||||
const env = process.env.GO_DISCOVERY_E2E_ENVIRONMENT;
|
||||
let ignore = 'ci';
|
||||
if (env == 'ci') {
|
||||
ignore = 'staging';
|
||||
let ignore = 'staging';
|
||||
if (env === 'staging' || env === 'prod') {
|
||||
ignore = 'ci';
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
|
|
|
@ -7,11 +7,18 @@
|
|||
|
||||
import { configureToMatchImageSnapshot } from 'jest-image-snapshot';
|
||||
|
||||
// When GO_DISCOVERY_E2E_ENVIRONMENT is not set to staging or prod, use the
|
||||
// snapshots in tests/e2e/__snapshots__/ci. Otherwise, use
|
||||
// tests/e2e/__snapshots__/staging. Data in taging and prod are always expected
|
||||
// to be the same.
|
||||
//
|
||||
// eslint-disable-next-line no-undef
|
||||
let env = process.env.GO_DISCOVERY_E2E_ENVIRONMENT;
|
||||
if (env != 'ci') {
|
||||
if (env === 'staging' || env === 'prod') {
|
||||
env = 'staging';
|
||||
} else {
|
||||
env = 'ci';
|
||||
}
|
||||
|
||||
const snapshotDir = `tests/e2e/__image_snapshots__/${env}`;
|
||||
|
||||
// Extends jest to compare image snapshots.
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2021 The Go Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style
|
||||
* license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
// When GO_DISCOVERY_E2E_ENVIRONMENT is not set to staging or prod, use the
|
||||
// snapshots in tests/e2e/__snapshots__/ci. Otherwise, use
|
||||
// tests/e2e/__snapshots__/staging. Data in staging and prod are always
|
||||
// expected to be the same.
|
||||
//
|
||||
// eslint-disable-next-line no-undef
|
||||
let env = process.env.GO_DISCOVERY_E2E_ENVIRONMENT;
|
||||
if (env != 'ci') {
|
||||
if (env === 'staging' || env === 'prod') {
|
||||
env = 'staging';
|
||||
} else {
|
||||
env = 'ci';
|
||||
}
|
||||
|
||||
const snapshotDir = `tests/e2e/__snapshots__/${env}`;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
|
|
Загрузка…
Ссылка в новой задаче