Skip to content

Commit f13f889

Browse files
RaisinTenrichardlau
authored andcommitted
test: add a test to ensure the correctness of timezone upgrades
Currently, there's no way to know if a timezone upgrade PR is correct without building and testing the change locally. This change provides a solution for that. Tested in RaisinTen#4. Signed-off-by: Darshan Sen <[email protected]> PR-URL: #45299 Backport-PR-URL: #45521 Reviewed-By: Antoine du Hamel <[email protected]> Fixes: #45276
1 parent c3a90c4 commit f13f889

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

test/fixtures/tz-version.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022e

test/parallel/test-tz-version.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
5+
if (!common.hasIntl) {
6+
common.skip('missing Intl');
7+
}
8+
9+
// Refs: https://github.com/nodejs/node/blob/1af63a90ca3a59ca05b3a12ad7dbea04008db7d9/configure.py#L1694-L1711
10+
if (process.config.variables.icu_path !== 'deps/icu-small') {
11+
// If Node.js is configured to use its built-in ICU, it uses a strict subset
12+
// of ICU formed using `tools/icu/shrink-icu-src.py`, which is present in
13+
// `deps/icu-small`. It is not the same as configuring the build with
14+
// `./configure --with-intl=small-icu`. The latter only uses a subset of the
15+
// locales, i.e., it uses the English locale, `root,en`, by default and other
16+
// locales can also be specified using the `--with-icu-locales` option.
17+
common.skip('not using the icu data file present in' +
18+
' deps/icu-small/source/data/in/icudt##l.dat.bz2');
19+
}
20+
21+
const fixtures = require('../common/fixtures');
22+
23+
// This test ensures the correctness of the automated timezone upgrade PRs.
24+
25+
const { strictEqual } = require('assert');
26+
const { readFileSync } = require('fs');
27+
28+
const expectedVersion = readFileSync(fixtures.path('tz-version.txt'),
29+
'utf8').trim();
30+
strictEqual(process.versions.tz, expectedVersion);

0 commit comments

Comments
 (0)