testEnvironment: 'node',
globals: {
__DEV__: true,
+ __TEST__: true,
__BROWSER__: true,
},
coverageDirectory: 'coverage',
: // hard coded dev/prod builds
JSON.stringify(!isProduction),
// this is only used during tests
- __TEST__: isBundlerESMBuild ? `(process.env.NODE_ENV === 'test')` : 'false',
+ __TEST__: 'false',
// If the build is expected to run directly in the browser (global / esm builds)
__BROWSER__: isBrowserBuild,
__FEATURE_PROD_DEVTOOLS__: isBundlerESMBuild
// Global compile-time constants
declare var __DEV__: boolean
+declare var __TEST__: boolean
declare var __FEATURE_PROD_DEVTOOLS__: boolean
declare var __BROWSER__: boolean
declare var __CI__: boolean
get: () => queue[position],
})
+ if (__TEST__) {
+ // @ts-ignore: only for tests
+ routerHistory.changeURL = function (url: string) {
+ const from = this.location
+ queue.splice(position++ + 1, queue.length, url)
+ triggerListeners(this.location, from, {
+ direction: NavigationDirection.unknown,
+ delta: 0,
+ })
+ }
+ }
+
return routerHistory
}