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

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-03-30 02:57:11 +00:00
require( 'dotenv' ).config();
2021-08-23 17:39:03 +00:00
const { BASE_URL, VERBOSE, USE_INDEX_PERMALINKS } = process.env;
2021-08-24 01:25:07 +00:00
const verboseOutput = VERBOSE === 'true';
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',
2021-08-23 17:39:03 +00:00
};