main
js 26 lines 970 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @emails react-core
8 * @jest-environment node
9 */
10
11 'use strict';
12
13 // NOTE: Intentionally using the dynamic version of the `gate` pragma to opt out
14 // the negative test behavior. If this test happens to pass when running
15 // against files source, that's fine. But all we care about is the behavior of
16 // the build artifacts.
17 // TODO: The experimental builds have a different version at runtime than
18 // the package.json because DevTools uses it for feature detection. Consider
19 // some other way of handling that.
20 test('ReactVersion matches package.json', () => {
21 if (gate(flags => flags.build && flags.stable && !flags.www)) {
22 const React = require('react');
23 const packageJSON = require('react/package.json');
24 expect(React.version).toBe(packageJSON.version);
25 }
26 });