Matt Bernstein
07/30/2021, 6:16 PMmberns@Matthews-MacBook-Pro premier-digital % npm test
> asset-prefix-rename@1.0.0 test
> jest
PASS __tests__/sample-test.js
Basic jest test with simple assert
✓ should assert stings are equal
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.149 s
Ran all test suites.
mberns@Matthews-MacBook-Pro premier-digital % npm test
> asset-prefix-rename@1.0.0 test
> jest
FAIL __tests__/sample-test.js
● Test suite failed to run
TypeError: Cannot destructure property 'config' of 'cacheKeyOptions' as it is undefined.
at Object.getCacheKey (node_modules/babel-jest/build/index.js:217:14)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.18 s, estimated 1 s
Ran all test suites.
jest.config.js file
const SuiteCloudJestConfiguration = require("@oracle/suitecloud-unit-testing/jest-configuration/SuiteCloudJestConfiguration");
module.exports = SuiteCloudJestConfiguration.build({
projectFolder: 'src',
projectType: SuiteCloudJestConfiguration.ProjectType.ACP,
});
sample-test.js file
describe('Basic jest test with simple assert', () => {
it('should assert stings are equal', () => {
const a = 'foobar';
const b = 'foobar';
expect(a).toMatch(b);
});
});
Project structure attached as imageAli Syed (NS DevTools QA)
07/30/2021, 7:18 PMAli Syed (NS DevTools QA)
07/30/2021, 7:19 PMMatt Bernstein
07/30/2021, 7:36 PMdbarnett
07/30/2021, 7:42 PMpackage.json
, what version of jest
do you have?
(basically I was seeing that same error when upgrading my packages & jest to v27, try downgrading jest to v26 - this resolved for me)