-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
69 lines (64 loc) · 2.18 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* @format
* @name JestConfig
* @description Jest config file for project
* @exports BuildJestConfig
*/
const SuiteCloudJestConfiguration = require('@oracle/suitecloud-unit-testing/jest-configuration/SuiteCloudJestConfiguration');
const cliConfig = require('./suitecloud.config');
const SuiteCloudJestStubs = require('suitecloud-unit-testing-stubs/SuiteCloudJestStubs');
const SuiteCloudJestCustomStubs = SuiteCloudJestStubs.customStubs;
/**
* @typedef ModulesPath
* @type {String}
* @description Local project root directory for modules to alias
*/
const ModulesPath = `${__dirname}/stubs/SuiteScripts/Modules`;
/**
* @typedef PathAlias
* @type {Object}
* @property {String} module - "Directory/Path/ModuleName" -- Custom module name/path to use
* @property {String} path - Path to module within current project -- see `ModulesPath` for example root dir
* @description Array of module names and paths to use for them in the stubs package
* @summary Here, you can control the paths for stubbed modules to their local file for Jest tests.
*/
/**
* @name PathAliases
* @type {PathAlias[]}
* @description Array of modules in project to provide module name aliases for
*/
const PathAliases = [
{
module: '/SuiteScripts/Modules/aModule',
path: `${ModulesPath}/aModule`,
},
{
module: '/SuiteScripts/Modules/aModule.min',
path: `${ModulesPath}/aModule`,
},
{
module: '/SuiteScripts/Modules/bModule',
path: `${ModulesPath}/bModule`,
},
{
module: '/SuiteScripts/Modules/bModule.min',
path: `${ModulesPath}/bModule`,
},
];
/**
* @name BuildJestConfig
* @function
* @description Builds Jest config file using stubs and SuiteCloud config
* @since 2022.2
*/
const BuildJestConfig = SuiteCloudJestConfiguration.build({
testResultsProcessor: './node_modules/jest-junit-reporter',
projectFolder: cliConfig.defaultProjectFolder,
projectType: SuiteCloudJestConfiguration.ProjectType.ACP,
customStubs: SuiteCloudJestCustomStubs.concat(PathAliases),
testPathIgnorePatterns: [
'(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
'**.*\\.min\\.*',
],
});
module.exports = BuildJestConfig;