Skip to content

Commit 7f48155

Browse files
committed
Patch 3.0.20. Update hook based component template to fix missing import. Add default jest.config.js to prevent duplicate tests running in build directory. Proactive module updates.
1 parent 8f634ab commit 7f48155

File tree

6 files changed

+560
-282
lines changed

6 files changed

+560
-282
lines changed

.core/.cli/commands/reactium/component/template/index-hook.hbs

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ import _ from 'underscore';
22
import cn from 'classnames';
33
import op from 'object-path';
44
import PropTypes from 'prop-types';
5-
65
import React, {
76
forwardRef,
7+
useImperativeHandle,
88
useEffect,
99
useLayoutEffect as useWindowEffect,
10-
useLayoutEffect,
1110
useRef,
1211
useState,
1312
} from 'react';
1413

14+
// Server-Side Render safe useLayoutEffect (useEffect when node)
15+
const useLayoutEffect = typeof window !== 'undefined' ? useWindowEffect : useEffect;
16+
1517
const ENUMS = {};
1618

1719
/**

.core/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import path from 'path';
1515
import fs from 'fs';
1616
import op from 'object-path';
1717
import staticGzip from 'express-static-gzip';
18+
import moment from 'moment';
1819

1920
global.defines = {};
2021
global.rootPath = path.resolve(__dirname, '..');
@@ -188,7 +189,11 @@ middlewares
188189

189190
// start server on the specified port and binding host
190191
app.listen(port, '0.0.0.0', function() {
191-
console.log(`[00:00:00] Reactium Server running on port '${port}'...`);
192+
console.log(
193+
`[${moment().format(
194+
'HH:mm:ss',
195+
)}] Reactium Server running on port '${port}'...`,
196+
);
192197
});
193198

194199
// Provide opportunity for ssl server

.core/reactium-config.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const manifestConfig = require('./manifest.config')(defaultManifestConfig);
101101
* @type {Object}
102102
*/
103103
module.exports = {
104-
version: '3.0.19',
104+
version: '3.0.20',
105105
semver: '^3.0.0',
106106
build: gulpConfig,
107107
update: {
@@ -213,6 +213,12 @@ module.exports = {
213213
destination: '/src/app/components/Fallback',
214214
source: '/tmp/update/src/app/components/Fallback',
215215
},
216+
{
217+
overwrite: false,
218+
version: '>=3.0.19',
219+
destination: '/jest.config.js',
220+
source: '/tmp/update/jest.config.js',
221+
},
216222
],
217223
remove: [],
218224
},

jest.config.js

+191
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// All imported modules in your tests should be mocked automatically
6+
// automock: false,
7+
8+
// Stop running tests after `n` failures
9+
// bail: 0,
10+
11+
// Respect "browser" field in package.json when resolving modules
12+
// browser: false,
13+
14+
// The directory where Jest should store its cached dependency information
15+
// cacheDirectory: "/private/var/folders/dh/ybwrm4cd2wb90jp43zm7t15w0000gn/T/jest_dx",
16+
17+
// Automatically clear mock calls and instances between every test
18+
// clearMocks: false,
19+
20+
// Indicates whether the coverage information should be collected while executing the test
21+
// collectCoverage: false,
22+
23+
// An array of glob patterns indicating a set of files for which coverage information should be collected
24+
// collectCoverageFrom: null,
25+
26+
// The directory where Jest should output its coverage files
27+
// coverageDirectory: null,
28+
29+
// An array of regexp pattern strings used to skip coverage collection
30+
// coveragePathIgnorePatterns: [
31+
// "/node_modules/"
32+
// ],
33+
34+
// A list of reporter names that Jest uses when writing coverage reports
35+
// coverageReporters: [
36+
// "json",
37+
// "text",
38+
// "lcov",
39+
// "clover"
40+
// ],
41+
42+
// An object that configures minimum threshold enforcement for coverage results
43+
// coverageThreshold: null,
44+
45+
// A path to a custom dependency extractor
46+
// dependencyExtractor: null,
47+
48+
// Make calling deprecated APIs throw helpful error messages
49+
// errorOnDeprecated: false,
50+
51+
// Force coverage collection from ignored files using an array of glob patterns
52+
// forceCoverageMatch: [],
53+
54+
// A path to a module which exports an async function that is triggered once before all test suites
55+
// globalSetup: null,
56+
57+
// A path to a module which exports an async function that is triggered once after all test suites
58+
// globalTeardown: null,
59+
60+
// A set of global variables that need to be available in all test environments
61+
// globals: {},
62+
63+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
64+
// maxWorkers: "50%",
65+
66+
// An array of directory names to be searched recursively up from the requiring module's location
67+
// moduleDirectories: [
68+
// "node_modules"
69+
// ],
70+
71+
// An array of file extensions your modules use
72+
// moduleFileExtensions: [
73+
// "js",
74+
// "json",
75+
// "jsx",
76+
// "ts",
77+
// "tsx",
78+
// "node"
79+
// ],
80+
81+
// A map from regular expressions to module names that allow to stub out resources with a single module
82+
// moduleNameMapper: {},
83+
84+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
85+
// modulePathIgnorePatterns: [],
86+
87+
// Activates notifications for test results
88+
// notify: false,
89+
90+
// An enum that specifies notification mode. Requires { notify: true }
91+
// notifyMode: "failure-change",
92+
93+
// A preset that is used as a base for Jest's configuration
94+
// preset: null,
95+
96+
// Run tests from one or more projects
97+
// projects: null,
98+
99+
// Use this configuration option to add custom reporters to Jest
100+
// reporters: undefined,
101+
102+
// Automatically reset mock state between every test
103+
// resetMocks: false,
104+
105+
// Reset the module registry before running each individual test
106+
// resetModules: false,
107+
108+
// A path to a custom resolver
109+
// resolver: null,
110+
111+
// Automatically restore mock state between every test
112+
// restoreMocks: false,
113+
114+
// The root directory that Jest should scan for tests and modules within
115+
// rootDir: null,
116+
117+
// A list of paths to directories that Jest should use to search for files in
118+
// roots: [
119+
// "<rootDir>"
120+
// ],
121+
122+
// Allows you to use a custom runner instead of Jest's default test runner
123+
// runner: "jest-runner",
124+
125+
// The paths to modules that run some code to configure or set up the testing environment before each test
126+
// setupFiles: [],
127+
128+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
129+
// setupFilesAfterEnv: [],
130+
131+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
132+
// snapshotSerializers: [],
133+
134+
// The test environment that will be used for testing
135+
testEnvironment: 'jsdom',
136+
137+
// Options that will be passed to the testEnvironment
138+
// testEnvironmentOptions: {},
139+
140+
// Adds a location field to test results
141+
// testLocationInResults: false,
142+
143+
// The glob patterns Jest uses to detect test files
144+
// testMatch: [
145+
// "**/__tests__/**/*.[jt]s?(x)",
146+
// "**/?(*.)+(spec|test).[tj]s?(x)"
147+
// ],
148+
149+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
150+
testPathIgnorePatterns: [
151+
'/node_modules/',
152+
'/build/',
153+
'/lib/',
154+
'/build-electron/',
155+
],
156+
157+
// The regexp pattern or array of patterns that Jest uses to detect test files
158+
// testRegex: [],
159+
160+
// This option allows the use of a custom results processor
161+
// testResultsProcessor: null,
162+
163+
// This option allows use of a custom test runner
164+
// testRunner: "jasmine2",
165+
166+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
167+
// testURL: "http://localhost",
168+
169+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
170+
// timers: "real",
171+
172+
// A map from regular expressions to paths to transformers
173+
// transform: null,
174+
175+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
176+
// transformIgnorePatterns: [
177+
// "/node_modules/"
178+
// ],
179+
180+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
181+
// unmockedModulePathPatterns: undefined,
182+
183+
// Indicates whether each individual test should be reported during the run
184+
// verbose: null,
185+
186+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
187+
// watchPathIgnorePatterns: [],
188+
189+
// Whether to use watchman for file crawling
190+
// watchman: true,
191+
};

0 commit comments

Comments
 (0)