I've been utilizing the "MVC ASP.NET Core with Angular" template. I'm attempting to incorporate phantomJS and execute the tests, but encountering the following errors:
ERROR in [at-loader] ..\\node_modules\zone.js\dist\zone.js.d.ts:122:11 TS2451: Cannot redeclare block-scoped variable 'Zone'.
ERROR in [at-loader] ..\\node_modules\zone.js\ dist\zone.js.d.ts:363:14 TS2300: Duplicate identifier 'HasTaskState'.
ERROR in [at-loader] ..\\node_modules\zone.js\ dist\zone.js.d.ts:372:14 TS2300: Duplicate identifier 'TaskType'.
ERROR in [at-loader] ..\\node_modules\zone.js\ dist\zone.js.d.ts:458:15 TS2451: Cannot redeclare block-scoped variable 'Zone'.
PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR ReferenceError: Can't find variable: Map at ../wwwroot/dist/vendor.js:12460
Listing the versions of node modules from my package.json file:
"dependencies": {
"@angular/animations": "4.1.2",
"@angular/common": "4.1.2",
...
"zone.js": "0.8.10"
},
"devDependencies": {
"@types/chai": "3.5.2",
...
"phantomjs-prebuilt": "^2.1.15"
}
}`
Here is a snippet of my tsconfig.json:
`{
"compilerOptions": {
"moduleResolution": "node",
...
},
"exclude": [
"bin",
"node_modules"
],
"atom": { "rewriteTsconfig": false }
}`
and the webpack.config.js that I'm using:
`const path = require('path');
const webpack = require('webpack');
...
};
`
Seeking guidance on resolving the aforementioned errors. Tried suggested solutions mentioned in https://github.com/monounity/karma-typescript/issues/83, but haven't found a solution yet.
Any assistance would be highly appreciated!
Anticipating a helpful response.
Thank you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`` Solution for integrating chrome headless:
added "puppeteer" in dev dependencies in package.json.
Configured in Karma.config.js:
const ChromiumRevision = require('puppeteer/package.json').puppeteer.chromium_revision;
const Downloader = require('puppeteer/utils/ChromiumDownloader');
const revisionInfo = Downloader.revisionInfo(Downloader.currentPlatform(), ChromiumRevision);
module.exports = function (config) {
config.set({ ...
browsers: ['ChromeHeadless'],
..
});
};