Skip to content

[BUG] setImmutable tests are relying on shared state with other test batches #853

@jdmarshall

Description

@jdmarshall

Describe the bug

vows' 'topic' only runs once per suite, and the way 2-config.test.js is set up, calls like

      CONFIG.util.makeImmutable(CONFIG.TestModule, 'arr1');

are actually doing nothing because makeImmutable(CONFIG.TestModule, 'arr1'); is legacy behavior, as documented in the code.

What is actually making this test pass is the 'Configurations from custom environment variables' suite which has called CONFIG.get() a couple dozen times already.

The call we think we are testing ends up short circuiting out instead of going recursive:

  // Backwards compatibility mode where property/value can be specified
  if (typeof property === 'string') {
    return Object.defineProperty(object, property, {
      value : (typeof value === 'undefined') ? object[property] : value,
      writable : false,
      configurable: false
    });
  }

So all of these tests are not testing the rest of the functionality.

I think one could also argue that all of these tests are also in the wrong order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions