The controller.bar/not-grouped/on-time test was failing on my computer because the date ranges happen to cross the end of Daylight Saving Time in the U.S., so chart was generated with one more hour of time than the test fixture expected.
Using moment-timezone to specify a fixed time zone with no DST seemed like the most robust fix. (Alternatively, I could pick a date range that doesn't change DST; that ought to work.)
{pattern: 'test/fixtures/**/*.json', included: false},
{pattern: 'test/fixtures/**/*.png', included: false},
'node_modules/moment/min/moment.min.js',
+ 'node_modules/moment-timezone/builds/moment-timezone-with-data.min.js',
{pattern: 'test/index.js', watched: false},
{pattern: 'test/BasicChartWebWorker.js', included: false},
{pattern: 'src/index.js', watched: false},
"luxon": "^1.26.0",
"markdown-it-include": "^2.0.0",
"moment": "^2.29.1",
+ "moment-timezone": "^0.5.34",
"pixelmatch": "^5.2.1",
"rollup": "^2.44.0",
"rollup-plugin-analyzer": "^4.0.0",
"node": "*"
}
},
+ "node_modules/moment-timezone": {
+ "version": "0.5.34",
+ "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.34.tgz",
+ "integrity": "sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg==",
+ "dev": true,
+ "dependencies": {
+ "moment": ">= 2.9.0"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/move-concurrently": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==",
"dev": true
},
+ "moment-timezone": {
+ "version": "0.5.34",
+ "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.34.tgz",
+ "integrity": "sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg==",
+ "dev": true,
+ "requires": {
+ "moment": ">= 2.9.0"
+ }
+ },
"move-concurrently": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
"luxon": "^1.26.0",
"markdown-it-include": "^2.0.0",
"moment": "^2.29.1",
+ "moment-timezone": "^0.5.34",
"pixelmatch": "^5.2.1",
"rollup": "^2.44.0",
"rollup-plugin-analyzer": "^4.0.0",
jasmine.triggerMouseEvent = triggerMouseEvent;
+// Set a fixed time zone (and, in particular, disable Daylight Saving Time) for
+// more stable test results.
+window.moment.tz.setDefault('Etc/UTC');
+
beforeEach(function() {
addMatchers();
});
datasets: [{
xAxisID: 'x',
data: [
- {t: +new Date('2018-01-08 05:14:23.234'), y: 10},
- {t: +new Date('2018-01-09 06:17:43.426'), y: 3}
+ // Normally (at least with the moment.js adapter), times would be in
+ // the user's local time zone. To allow for more stable tests, our
+ // tests/index.js sets moment.js to use UTC; use `Z` here to match.
+ {t: +new Date('2018-01-08 05:14:23.234Z'), y: 10},
+ {t: +new Date('2018-01-09 06:17:43.426Z'), y: 3}
]
}],
},
}
});
- // NOTE: built-in adapter uses moment
+ // NOTE: the test suite is configured to use moment
var expected = {
datetime: 'MMM D, YYYY, h:mm:ss a',
millisecond: 'h:mm:ss.SSS a',
}
});
- // NOTE: built-in adapter uses moment
+ // NOTE: the test suite is configured to use moment
var expected = {
datetime: 'MMM D, YYYY, h:mm:ss a',
millisecond: 'foo',