woocommerce/packages/js/api-core-tests/jest.config.js

58 lines
1.5 KiB
JavaScript
Raw Normal View History

2022-03-30 02:57:11 +00:00
require( 'dotenv' ).config();
REP: Post daily smoke test report on Slack (#33203) * Separate job for api test * Remove unnecessary comment * Use ubuntu 20.04 in job "publish-test-report" * Simplify syntax in "if" condition * Temporarily add push trigger for testing * Temporarily disable running jest e2e tests for testing * Remove unnecessary OR operator * try: disable certain jobs for testing * try: run 'hello' api test for testing * Implement timeout override in API tests * Allow workflow to override timeout of api tests * Correct parsing of timeout override * try: temporarily disable e2e job * try: make api test verbose for troubleshooting * try: temporarily disable some install steps for testing * Correct smoke test env vars * try: run all api tests * Re-enable install-build steps * Correct smoke test env var values * Temporarily disable running all e2e tests after WC upgrade * Remove unnecessary flag for daily smoke test runs * Use different workflow for publishing daily smoke test report * Use env vars instead of github expressions in accessing job outputs * Correct multiline syntax * Correct api_artifact input value * Take only the first line of commit message * Correct passing of input value * Re-enable jobs before submitting for review * Separate job for api test * Remove unnecessary comment * Use ubuntu 20.04 in job "publish-test-report" * Simplify syntax in "if" condition * Temporarily add push trigger for testing * Temporarily disable running jest e2e tests for testing * Remove unnecessary OR operator * try: disable certain jobs for testing * try: run 'hello' api test for testing * Implement timeout override in API tests * Allow workflow to override timeout of api tests * Correct parsing of timeout override * try: temporarily disable e2e job * try: make api test verbose for troubleshooting * try: temporarily disable some install steps for testing * Correct smoke test env vars * try: run all api tests * Re-enable install-build steps * Correct smoke test env var values * Temporarily disable running all e2e tests after WC upgrade * Remove unnecessary flag for daily smoke test runs * Use different workflow for publishing daily smoke test report * Use env vars instead of github expressions in accessing job outputs * Correct multiline syntax * Correct api_artifact input value * Take only the first line of commit message * Correct passing of input value * Re-enable jobs before submitting for review * Add push trigger for final testing * Re-enable e2e tests, remove push trigger before merge * Fix spacing * Correct slack channel id
2022-05-31 18:57:04 +00:00
const {
BASE_URL,
VERBOSE,
USE_INDEX_PERMALINKS,
DEFAULT_TIMEOUT_OVERRIDE,
} = process.env;
2021-08-24 01:25:07 +00:00
const verboseOutput = VERBOSE === 'true';
REP: Post daily smoke test report on Slack (#33203) * Separate job for api test * Remove unnecessary comment * Use ubuntu 20.04 in job "publish-test-report" * Simplify syntax in "if" condition * Temporarily add push trigger for testing * Temporarily disable running jest e2e tests for testing * Remove unnecessary OR operator * try: disable certain jobs for testing * try: run 'hello' api test for testing * Implement timeout override in API tests * Allow workflow to override timeout of api tests * Correct parsing of timeout override * try: temporarily disable e2e job * try: make api test verbose for troubleshooting * try: temporarily disable some install steps for testing * Correct smoke test env vars * try: run all api tests * Re-enable install-build steps * Correct smoke test env var values * Temporarily disable running all e2e tests after WC upgrade * Remove unnecessary flag for daily smoke test runs * Use different workflow for publishing daily smoke test report * Use env vars instead of github expressions in accessing job outputs * Correct multiline syntax * Correct api_artifact input value * Take only the first line of commit message * Correct passing of input value * Re-enable jobs before submitting for review * Separate job for api test * Remove unnecessary comment * Use ubuntu 20.04 in job "publish-test-report" * Simplify syntax in "if" condition * Temporarily add push trigger for testing * Temporarily disable running jest e2e tests for testing * Remove unnecessary OR operator * try: disable certain jobs for testing * try: run 'hello' api test for testing * Implement timeout override in API tests * Allow workflow to override timeout of api tests * Correct parsing of timeout override * try: temporarily disable e2e job * try: make api test verbose for troubleshooting * try: temporarily disable some install steps for testing * Correct smoke test env vars * try: run all api tests * Re-enable install-build steps * Correct smoke test env var values * Temporarily disable running all e2e tests after WC upgrade * Remove unnecessary flag for daily smoke test runs * Use different workflow for publishing daily smoke test report * Use env vars instead of github expressions in accessing job outputs * Correct multiline syntax * Correct api_artifact input value * Take only the first line of commit message * Correct passing of input value * Re-enable jobs before submitting for review * Add push trigger for final testing * Re-enable e2e tests, remove push trigger before merge * Fix spacing * Correct slack channel id
2022-05-31 18:57:04 +00:00
const { defaults } = require( 'jest-config' );
/**
* Override the default timeout, if specified.
* Useful when running API tests against an externally hosted test site.
*/
const testTimeoutOverride = DEFAULT_TIMEOUT_OVERRIDE
? Number( DEFAULT_TIMEOUT_OVERRIDE )
: defaults.testTimeout;
2021-08-23 17:39:03 +00:00
// Update the API path if the `USE_INDEX_PERMALINKS` flag is set
2021-08-24 01:25:07 +00:00
const useIndexPermalinks = USE_INDEX_PERMALINKS === 'true';
2022-03-30 02:57:11 +00:00
let apiPath = `${ BASE_URL }/?rest_route=/wc/v3/`;
2021-09-07 22:20:44 +00:00
if ( useIndexPermalinks ) {
2022-03-30 02:57:11 +00:00
apiPath = `${ BASE_URL }/wp-json/wc/v3/`;
2021-08-23 17:39:03 +00:00
}
module.exports = {
// Use the `jest-runner-groups` package.
2021-08-24 01:25:07 +00:00
runner: 'groups',
2021-08-23 17:39:03 +00:00
// A set of global variables that need to be available in all test environments
globals: {
2021-08-24 01:25:07 +00:00
API_PATH: apiPath,
2021-08-23 17:39:03 +00:00
},
// Indicates whether each individual test should be reported during the run
verbose: verboseOutput,
2022-03-30 02:57:11 +00:00
/**
* Configure `jest-allure` for Jest v24 and above.
*
* @see https://www.npmjs.com/package/jest-allure#jest--v-24-
*/
setupFilesAfterEnv: [
'jest-allure/dist/setup',
'<rootDir>/allure.config.js',
],
/**
* Make sure Jest is using Jasmine as its test runner.
* `jest-allure` does not work with the `jest-circus` test runner, which is the default test runner of Jest starting from v27.
*
* @see https://github.com/zaqqaz/jest-allure#uses-jest-circus-or-jest--v-27-
*/
testRunner: 'jasmine2',
REP: Post daily smoke test report on Slack (#33203) * Separate job for api test * Remove unnecessary comment * Use ubuntu 20.04 in job "publish-test-report" * Simplify syntax in "if" condition * Temporarily add push trigger for testing * Temporarily disable running jest e2e tests for testing * Remove unnecessary OR operator * try: disable certain jobs for testing * try: run 'hello' api test for testing * Implement timeout override in API tests * Allow workflow to override timeout of api tests * Correct parsing of timeout override * try: temporarily disable e2e job * try: make api test verbose for troubleshooting * try: temporarily disable some install steps for testing * Correct smoke test env vars * try: run all api tests * Re-enable install-build steps * Correct smoke test env var values * Temporarily disable running all e2e tests after WC upgrade * Remove unnecessary flag for daily smoke test runs * Use different workflow for publishing daily smoke test report * Use env vars instead of github expressions in accessing job outputs * Correct multiline syntax * Correct api_artifact input value * Take only the first line of commit message * Correct passing of input value * Re-enable jobs before submitting for review * Separate job for api test * Remove unnecessary comment * Use ubuntu 20.04 in job "publish-test-report" * Simplify syntax in "if" condition * Temporarily add push trigger for testing * Temporarily disable running jest e2e tests for testing * Remove unnecessary OR operator * try: disable certain jobs for testing * try: run 'hello' api test for testing * Implement timeout override in API tests * Allow workflow to override timeout of api tests * Correct parsing of timeout override * try: temporarily disable e2e job * try: make api test verbose for troubleshooting * try: temporarily disable some install steps for testing * Correct smoke test env vars * try: run all api tests * Re-enable install-build steps * Correct smoke test env var values * Temporarily disable running all e2e tests after WC upgrade * Remove unnecessary flag for daily smoke test runs * Use different workflow for publishing daily smoke test report * Use env vars instead of github expressions in accessing job outputs * Correct multiline syntax * Correct api_artifact input value * Take only the first line of commit message * Correct passing of input value * Re-enable jobs before submitting for review * Add push trigger for final testing * Re-enable e2e tests, remove push trigger before merge * Fix spacing * Correct slack channel id
2022-05-31 18:57:04 +00:00
testTimeout: testTimeoutOverride,
2021-08-23 17:39:03 +00:00
};