message: Make esm-amd-loader dynamic require 404 test not flaky.
  Previously this test used a 1 second timeout to wait to see how many
  times the error callback was called, which was flaky on CI. Now we
  capture 404 errors and check callback calls after two 404s.
  Fixes
diff: @@ -268,19 +268,25 @@ suite('dynamic require', () => {
  });
  test('calls error callback only once on multiple 404s', (done) => {
  - let numErrors = 0;
  + let num404s = 0;
  + let numCallbackCalls = 0;
  +
  + window.addEventListener('error', on404, true);
  +
  + function on404() {
  + if (++num404s === 2) {
  + window.removeEventListener('error', on404);
  + assert.equal(numCallbackCalls, 1);
  + done();
  + }
  + }
  define(['require'], (require: any) => {
  require(
  ['./not-found-a.js', './not-found-b.js'],
  () => assert.fail(),
  - () => numErrors++);
  + () => numCallbackCalls++);
  });
  -
  - setTimeout(() => {
  - assert.equal(numErrors, 1);
  - done();
  - }, 1000);
  });
  });
  