Skip to content

Commit

Permalink
Fix: test regression
Browse files Browse the repository at this point in the history
  • Loading branch information
gabidobo committed Aug 17, 2022
1 parent 00fa82f commit aee7d45
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/index.js
Expand Up @@ -253,7 +253,7 @@ const init = async ({
const {name: module, stack, error} = getCurrentModule();
logger.debug(`${module} called ${family.name}.${method.name} with`, args);
const allowed = isModuleAllowedToExecute(module, family, method);
if (true || devMode) {
if (devMode) {
const event = {
module,
family: family.name,
Expand Down Expand Up @@ -326,7 +326,7 @@ const init = async ({
};

const getHistory = () => {
if (true || devMode) {
if (devMode) {
return history;
}

Expand Down
11 changes: 9 additions & 2 deletions tests/utils.js
Expand Up @@ -30,14 +30,16 @@ const callExpects = ({call, family, method, firstArg, secondArg}) => {
};

const expectCallToMatch = ({family, method, firstArg, secondArg, index = 0, fromRoot = false}) => {
const call = Sandworm.getHistory().filter(
({module}) => module === (fromRoot ? 'root' : 'jest-runner>jest-circus'),
// console.log(Sandworm.getHistory().map((call) => `${call.module}: ${call.family}.${call.method}`));
const call = Sandworm.getHistory().filter(({module}) =>
(fromRoot ? ['root'] : ['jest-runner>jest-circus', 'jest-circus']).includes(module),
)[index];

callExpects({call, family, method, firstArg, secondArg});
};

const expectCallToThrow = (call) => {
// console.log(Sandworm.getHistory().map((c) => `${c.module}: ${c.family}.${c.method}`));
expect(call).toThrow(Sandworm.Error);
};

Expand Down Expand Up @@ -70,8 +72,13 @@ const loadSandwormInProductionMode = async () =>
skipTracking: true,
allowInitFrom: /jest-circus/,
permissions: [
// These are the Jest runner modules on node v12.0.0+
{module: 'jest-runner>jest-circus>expect', permissions: false},
{module: 'jest-runner>jest-circus', permissions: false},
// These are the Jest runner modules on node v12.0.0 and below
{module: 'jest-circus>expect', permissions: false},
{module: 'jest-circus', permissions: false},
// These are required by Jest
{module: /jest/, permissions: true},
{module: /istanbul/, permissions: true},
{module: /babel/, permissions: true},
Expand Down

0 comments on commit aee7d45

Please sign in to comment.