Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-2345

Handle common test runner stuff in test/runner/index.js

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Native, Testing
    • None

      There are a bunch of things we tend to do a lot for our tests that could be combined into a single location at test/runner/index.js.

      Items that come to mind are:

      • Creating a sinon sandbox that resets after each test
      • Using certain chai plugins like chai-subset.
      • Setting certain chai config flags

      Something like the following would be nice:

      
      const chai = require('chai');
      chai.use(require('chai-subset'));
      chai.config.includeStack = true;
      chai.config.showDiff = true;
      chai.config.truncateThreshold = 0;
      
      before(function() {
        this.sinon = sinon.sandbox.create();
      
        // not sure about this one, but it could be useful to avoid pulling in expect at the top of each file.
        this.expect = chai.expect;
      });
      
      afterEach(function() {
        this.sinon.restore();
      });
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: