daisy / ace

Ace by DAISY, an Accessibility Checker for EPUB
MIT License
75 stars 22 forks source link

Ace TravisCI unit tests fail (yet pass on MacOS, Windows and Linux) #322

Closed danielweck closed 4 years ago

danielweck commented 4 years ago

Latest Ace 1.2.0-beta.13: https://github.com/daisy/ace/pull/315

https://travis-ci.org/github/daisy/ace/jobs/684576632

TypeError: _fakeTimers(...).LegacyFakeTimers is not a constructor

danielweck commented 4 years ago

https://travis-ci.org/github/daisy/ace/jobs/684601865

Investigation shows that the LegacyFakeTimers class is in fact undefined

https://github.com/facebook/jest/blob/master/packages/jest-environment-node/src/index.ts https://unpkg.com/browse/jest-environment-node@26.0.1/build/index.js

this.fakeTimers = new (_fakeTimers().LegacyFakeTimers)({
      config,
      global,
      moduleMocker: this.moduleMocker,
      timerConfig
    });

I note the typical TypeScript transpiled output for default exports and __esModule, but this works just fine in other Linux computers, so I fail to see what is specific to Travis here (same Node versions):

https://github.com/facebook/jest/blob/master/packages/jest-fake-timers/src/legacyFakeTimers.ts https://unpkg.com/browse/@jest/fake-timers@26.0.1/build/legacyFakeTimers.js

Object.defineProperty(exports, '__esModule', {

https://github.com/facebook/jest/blob/master/packages/jest-fake-timers/src/index.ts https://unpkg.com/browse/@jest/fake-timers@26.0.1/build/index.js

'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true
});

Object.defineProperty(exports, 'LegacyFakeTimers', {
  enumerable: true,
  get: function () {
    return _legacyFakeTimers.default;
  }
});

var _legacyFakeTimers = _interopRequireDefault(require('./legacyFakeTimers'));

function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : {default: obj};
}
danielweck commented 4 years ago

Note that other modules work, such as this.moduleMocker = new (_jestMock().ModuleMocker)(global);: https://unpkg.com/browse/jest-environment-node@26.0.1/build/index.js => https://unpkg.com/browse/jest-mock@26.0.1/build/index.js

...so I am guessing the problem stems from the level of indirection: https://unpkg.com/browse/@jest/fake-timers@26.0.1/build/index.js

danielweck commented 4 years ago

Fixed: https://travis-ci.org/github/daisy/ace/builds/684668999