-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
What is the current behavior?
In my unit tests, I have a simple setup function:
function setup(...airports: Array<{airport: Airport, style?: fromViewerData.GeoJsonStyle}>) {
const [store, airport] = initialState(...airports);
console.log("REMOVE ME: store: %s", JSON.stringify(store, null, 2));
console.log("REMOVE ME: airport: %s", JSON.stringify(airport, null, 2));
TestBed.configureTestingModule({
imports: [
StoreModule.forRoot(fromEventAnalyzer.reducers(), {initialState: store}),
EffectsModule.forRoot([]),
StoreModule.forFeature(AirportPlugin.ID, reducer, {initialState: airport}),
EffectsModule.forFeature([AirportEffects]),
ToasterModule,
],
providers: [
Actions,
{ provide: StyleGenerator, useValue: StaticStyleGenerator.INSTANCE },
{ provide: AirportService, useClass: MockAirportService },
{ provide: LoggerService, useClass: ConsoleLoggerService },
],
});
TestBed.get(Store).select(fromEventAnalyzer.getState)
.subscribe((state: fromEventAnalyzer.EventAnalyzerState) => {
console.log("REMOVE ME: state: %s", JSON.stringify(state, null, 2));
});
return {
actions: TestBed.get(Actions) as Actions,
logger: TestBed.get(LoggerService) as LoggerService,
service: TestBed.get(AirportService) as AirportService,
store: TestBed.get(Store) as Store<fromEventAnalyzer.EventAnalyzerState>,
};
}
This allows me to hydrate the store with a known initial state before each test. Using the console.log statements, I verified that the incoming state correct, however, the store only initializes the store half, and leaves the airport half uninitialized (falls through to the default value defined in the reducer). Perhaps I am doing something wrong by including both a forRoot and a forFeature in the same imports, but not sure on that...
Expected behavior:
The Store should be initialized with both sets of initialState.
Minimal reproduction of the problem with instructions:
I attempted to create a reproduction by creating another test in this project, but alas, I am unable to build:
PS C:\Users\ltheisen\git\ngrx-platform> npm run build
> @ngrx/platform@4.0.0 build C:\Users\ltheisen\git\ngrx-platform
> ts-node ./build/index.ts
√ Removing "./dist" Folder
√ Compiling packages with NGC
√ Bundling FESMs
√ Down-leveling FESMs to ES5
√ Creating UMD Bundles
√ Renaming package entry files
√ Cleaning TypeScript files
√ Removing remaining sourcemap files
× Copying type definition files
{ Error: ENOENT: no such file or directory, chmod 'C:\Users\ltheisen\git\ngrx-platform\dist\effects\src\actions.d.ts'
errno: -4058,
code: 'ENOENT',
syscall: 'chmod',
path: 'C:\\Users\\ltheisen\\git\\ngrx-platform\\dist\\effects\\src\\actions.d.ts' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ngrx/platform@4.0.0 build: `ts-node ./build/index.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ngrx/platform@4.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ltheisen\AppData\Roaming\npm-cache\_logs\2017-07-27T21_45_51_702Z-debug.log
Perhaps you don't support windows for builds?
Version of affected browser(s),operating system(s), npm, node and ngrx:
Windows: Microsoft Windows [Version 10.0.14393]
node: v8.2.1
npm: 5.0.3
ngrx/store: 4.0.0
ngrx/effects: 4.0.1
Other information:
💗 ngrx? Please consider supporting our collective: 👉 donate