1
ロケール依存の日付計算をmochaでテストしたいと思います。しかし、ロケールが異なるdescribe
機能にリセットされていないようです:mochaの異なるロケールでmoment.jsをテストする方法
var expect = require('chai').expect,
moment = require('moment');
describe('English locale', function() {
moment.locale('en');
it('uses Sunday as start of week', function() {
// Monday, 5th September 2016
var d = moment('2016-09-05').weekday(0);
expect(d.date()).to.equal(4);
});
});
describe('German locale', function() {
moment.locale('de');
it('uses Monday as start of week', function() {
// Monday, 5th September 2016
var d = moment('2016-09-05').weekday(0);
expect(d.date()).to.equal(5);
});
});
どのように私は私のdescribe
ブロック内の特定の「ロケール」環境を作成することができますか?
documentationは、ロケール固有の方法でオブジェクトの書式を設定する方法のみを示します。特定のロケールのオブジェクトを作成します。