Skip to content

Commit f8586d5

Browse files
authored
revert(apex-methods-automock): reverts functionality providing apex automocks (#234)
fixes #232 This PR reverts #231, #210, and #208. They provided functionality to auto mock apex methods. **Note:** Test authors will need to keep implementing their own apex (+apexContinuation) methods mocks after this PR is merged. * Revert "fix: apex automock should return a resolved promise (#231)" This reverts commit 544f95a. * Revert "fix: add apex stubs to the transformIgnorePatterns (#210)" This reverts commit fe8381a. * Revert "fix: automock apex methods with valid wire adapters (#208)" This reverts commit 125c689.
1 parent 544f95a commit f8586d5

File tree

6 files changed

+5
-67
lines changed

6 files changed

+5
-67
lines changed

Diff for: .eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"overrides": [
1616
{
17-
"files": ["src/lightning-stubs/**", "src/apex-stubs/**"],
17+
"files": ["src/lightning-stubs/**"],
1818
"parser": "babel-eslint",
1919
"parserOptions": {
2020
"sourceType": "module"

Diff for: jest.config.js

-19
This file was deleted.

Diff for: src/apex-stubs/method/__tests__/apex-method.test.js

-18
This file was deleted.

Diff for: src/apex-stubs/method/method.js

-9
This file was deleted.

Diff for: src/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const jestConfig = {
2626
'^.+\\.(js|html|css)$': require.resolve('@lwc/jest-transformer'),
2727
},
2828
transformIgnorePatterns: [
29-
'/node_modules/(?!(.*@salesforce/sfdx-lwc-jest/src/(lightning|apex)-stubs)/)',
29+
'/node_modules/(?!(.*@salesforce/sfdx-lwc-jest/src/lightning-stubs)/)',
3030
],
3131
setupFilesAfterEnv: jestPreset.setupFilesAfterEnv || [],
3232
resolver: path.resolve(__dirname, './resolver.js'),

Diff for: src/resolver.js

+3-19
Original file line numberDiff line numberDiff line change
@@ -47,36 +47,20 @@ function resolveAsFile(name, extensions) {
4747
return undefined;
4848
}
4949

50-
function getModuleMock(modulePath, moduleName) {
51-
const p = path.join(__dirname, modulePath, moduleName);
50+
function getLightningMock(modulePath) {
51+
const p = path.join(__dirname, 'lightning-stubs', modulePath);
5252
if (fs.existsSync(p)) {
53-
return path.join(p, moduleName + '.js');
53+
return path.join(p, modulePath + '.js');
5454
}
5555
}
5656

57-
function getLightningMock(moduleName) {
58-
return getModuleMock('lightning-stubs', moduleName);
59-
}
60-
61-
function getApexMock(moduleName) {
62-
return getModuleMock('apex-stubs', moduleName);
63-
}
64-
6557
function getModule(modulePath, options) {
6658
const { ns, name } = getInfoFromId(modulePath);
6759

6860
if (ns === 'lightning') {
6961
return getLightningMock(name);
7062
}
7163

72-
// See https://developer.salesforce.com/docs/component-library/documentation/en/lwc/reference_salesforce_modules
73-
if (
74-
modulePath.startsWith('@salesforce/apex/') ||
75-
modulePath.startsWith('@salesforce/apexContinuation/')
76-
) {
77-
return getApexMock('method');
78-
}
79-
8064
if (ns === DEFAULT_NAMESPACE) {
8165
const paths = getModulePaths();
8266
for (let i = 0; i < paths.length; i++) {

0 commit comments

Comments
 (0)