Skip to content

--include does not work when in 'opts' file [Bug] #73

Open
@gdarai

Description

@gdarai
  • I'd be willing to submit the fix

Describe the bug
I am upgrading our libraries, so I swapped to mochapack and now I have an issue:
We are having global memory clearing method in cleanUpResources.js

afterEach('Cleanup after test', function () {
    // Remove all listeners added by our test
    console.log('-- clear --');
    listeners.window.forEach((listener) => window.removeEventListener(listener.type, listener.listener));
    listeners.document.forEach((listener) => document.removeEventListener(listener.type, listener.listener));
    listeners.window = [];
    listeners.document = [];
    // Restore sinon sandbox
    sinon.reset();
    sinon.restore();
});

Loading this file using
--include ./test/cleanupResources.js
also using parameter
--opts mochapack.opts

--colors
--recursive
--full-trace
--require mock-local-storage
--require ./test/test_helpers.js
--include ./test/cleanupResources.js

clear and concise description of what the bug is.

when I have the include inline directly it loads the cleanup file. When I have it in the opts file, it does not.

To Reproduce

You can do the same thing I did... have an --include with some file and in it have afterEach with console.log and check the difference with inline and in opts solution.

Environment if relevant (please complete the following information):

Currently I am bypassing this using the inline solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions