Skip to content

Is the "verifyAndScrub" function still available? #585

@JanVanRyswyck

Description

@JanVanRyswyck

I've been trying to upgrade from an older version to the latest version. I noticed that the "verifyAndScrub" function is no longer available. Is this intentional, as it is still described in the documentation.

When I run this code:

const path = require("node:path");
const approvals = require("approvals");
const Scrubbers = require('approvals/lib/Scrubbers/Scrubbers').Scrubbers;
const { Subject } = require('./Subject');

const approvalsDirName = path.join(__dirname, 'approvals');

describe('Approval tests', function() {

    it('should do something', function() {
        const output = Subject.doSomething();
        approvals.verifyAndScrub(approvalsDirName, 'doSomething', output, dateScrubber());
    });

    function dateScrubber() {
        const regex = /[a-zA-Z]{3} [a-zA-Z]{3} \d{2} \d{4} \d{2}:\d{2}:\d{2} [a-zA-Z]{3}\+\d{4} \(.*\)/g
        return Scrubbers.createReqexScrubber(regex, t => `<date_${t}>`);
    }
});

I get the following error: TypeError: approvals.verifyAndScrub is not a function

I've included a test project to simulate this. Am I missing something?
Thanks in advance.

approvals-test.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions