Skip to content

Commit 1cacb5a

Browse files
committed
Fix istanbul cli error (replace with nyc)
``` require(...).create is not a function TypeError: require(...).create is not a function at Object.<anonymous> (/home/travis/build/SUSE/stratos/node_modules/istanbul/lib/report/html.js:7:40) ```
1 parent 20582d5 commit 1cacb5a

7 files changed

+840
-157
lines changed

angular.json

+26-34
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@
3636
},
3737
"configurations": {
3838
"production": {
39-
"budgets": [
40-
{
41-
"type": "anyComponentStyle",
42-
"maximumWarning": "6kb"
43-
}
44-
],
39+
"budgets": [{
40+
"type": "anyComponentStyle",
41+
"maximumWarning": "6kb"
42+
}],
4543
"optimization": true,
4644
"outputHashing": "all",
4745
"sourceMap": false,
@@ -51,12 +49,10 @@
5149
"extractLicenses": true,
5250
"vendorChunk": false,
5351
"buildOptimizer": true,
54-
"fileReplacements": [
55-
{
56-
"replace": "src/frontend/packages/core/src/environments/environment.ts",
57-
"with": "src/frontend/packages/core/src/environments/environment.prod.ts"
58-
}
59-
]
52+
"fileReplacements": [{
53+
"replace": "src/frontend/packages/core/src/environments/environment.ts",
54+
"with": "src/frontend/packages/core/src/environments/environment.prod.ts"
55+
}]
6056
}
6157
}
6258
},
@@ -132,18 +128,14 @@
132128
},
133129
"configurations": {
134130
"production": {
135-
"budgets": [
136-
{
137-
"type": "anyComponentStyle",
138-
"maximumWarning": "6kb"
139-
}
140-
],
141-
"fileReplacements": [
142-
{
143-
"replace": "src/frontend/packages/core/src/environments/environment.ts",
144-
"with": "src/frontend/packages/core/src/environments/environment.prod.ts"
145-
}
146-
],
131+
"budgets": [{
132+
"type": "anyComponentStyle",
133+
"maximumWarning": "6kb"
134+
}],
135+
"fileReplacements": [{
136+
"replace": "src/frontend/packages/core/src/environments/environment.ts",
137+
"with": "src/frontend/packages/core/src/environments/environment.prod.ts"
138+
}],
147139
"optimization": true,
148140
"outputHashing": "all",
149141
"sourceMap": false,
@@ -229,13 +221,13 @@
229221
"options": {
230222
"tsConfig": "src/frontend/packages/store/tsconfig.lib.json",
231223
"project": "src/frontend/packages/store/ng-package.json"
232-
}
233-
, "configurations": {
224+
},
225+
"configurations": {
234226
"production": {
235227
"tsConfig": "src/frontend/packages/store/tsconfig.lib.prod.json"
236228
}
237229
}
238-
},
230+
},
239231
"test": {
240232
"builder": "@angular-devkit/build-angular:karma",
241233
"options": {
@@ -272,13 +264,13 @@
272264
"options": {
273265
"tsConfig": "src/frontend/packages/cloud-foundry/tsconfig.lib.json",
274266
"project": "src/frontend/packages/cloud-foundry/ng-package.json"
275-
}
276-
, "configurations": {
267+
},
268+
"configurations": {
277269
"production": {
278270
"tsConfig": "src/frontend/packages/cloud-foundry/tsconfig.lib.prod.json"
279271
}
280272
}
281-
},
273+
},
282274
"test": {
283275
"builder": "@angular-devkit/build-angular:karma",
284276
"options": {
@@ -315,13 +307,13 @@
315307
"options": {
316308
"tsConfig": "src/frontend/packages/cf-autoscaler/tsconfig.lib.json",
317309
"project": "src/frontend/packages/cf-autoscaler/ng-package.json"
318-
}
319-
, "configurations": {
310+
},
311+
"configurations": {
320312
"production": {
321313
"tsConfig": "src/frontend/packages/cf-autoscaler/tsconfig.lib.prod.json"
322314
}
323315
}
324-
},
316+
},
325317
"test": {
326318
"builder": "@angular-devkit/build-angular:karma",
327319
"options": {
@@ -361,4 +353,4 @@
361353
"cli": {
362354
"_defaultCollection": "@nrwl/angular"
363355
}
364-
}
356+
}

build/combine-coverage.js

-10
This file was deleted.

build/karma.conf.creator.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ module.exports = function (project) {
2727
coverageIstanbulReporter: {
2828
dir: path.join(repoRoot, 'coverage', project),
2929
reports: ['html', 'lcovonly', 'json'],
30-
fixWebpackSourcePaths: true
30+
fixWebpackSourcePaths: true,
31+
'report-config': {
32+
json: {
33+
// Collate all coverage-final files into a single dir for nyc to combine (it can't pick them out from `coverage`)
34+
file: path.join('..', 'nyc', project + '-coverage-final.json')
35+
}
36+
},
3137
},
3238
reporters: ['spec', 'kjhtml', 'stratos'],
3339
specReporter: {

build/karma.test.reporter.js

+42-43
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
(function () {
32
'use strict';
43

@@ -75,7 +74,7 @@
7574
fs.unlinkSync(this.summaryFile);
7675
}
7776

78-
const all = this.runningTotals;
77+
const all = this.runningTotals;
7978

8079
this.writeSummaryFile(`${this.bold}${this.cyan}================================================================================${this.reset}`);
8180
this.writeSummaryFile(`${this.bold}${this.cyan}Test Summary${this.reset}`);
@@ -106,47 +105,47 @@
106105

107106
try {
108107

109-
this.writeFile(`${this.bold}${this.cyan}Test results for package ${this.bluebg} ${process.env.NG_TEST_SUITE} ${this.reset}`);
110-
this.writeFile(`Total : ${this.bold}${this.cyan}${this.total}${this.reset}`)
111-
this.writeFile(`Passed : ${this.bold}${this.cyan}${passed}${this.reset}`)
112-
this.writeFile(`Failed : ${this.bold}${this.red}${this.failed.length}${this.reset}`)
113-
this.writeFile(`Skipped : ${this.bold}${this.yellow}${this.skipped}${this.reset}`)
114-
115-
if (this.failed.length === 0) {
116-
fs.appendFileSync(this.file, 'All tests passed\n')
117-
} else {
118-
this.writeFile('Test failures:');
119-
this.failed.forEach(f => {
120-
this.writeFile(`${this.red}${this.bold} - ${f.fullName}${this.reset}`);
121-
const logs = f.log || [];
122-
logs.forEach(l => fs.appendFileSync(this.file, `${this.grey} ${l}${this.reset}`));
123-
// Add empty line
124-
this.writeFile('');
125-
});
126-
}
127-
128-
// Update running totals JSON
129-
this.runningTotals.total += this.total;
130-
this.runningTotals.passed += passed;
131-
this.runningTotals.failed += this.failed.length;
132-
this.runningTotals.skipped += this.skipped;
133-
fs.writeFileSync(this.jsonFile, JSON.stringify(this.runningTotals));
134-
135-
this.generateSummary();
136-
137-
// Write exit code
138-
let newExitCode = this.exitCode;
139-
if (result.exitCode > 0) {
140-
newExitCode = result.exitCode
141-
}
142-
143-
fs.writeFileSync(this.exitCodeFile, newExitCode.toString());
144-
145-
// Dump the summary for this test suite
146-
var contents = fs.readFileSync(this.file, 'utf8');
147-
console.log(contents);
148-
149-
} catch(e) {
108+
this.writeFile(`${this.bold}${this.cyan}Test results for package ${this.bluebg} ${process.env.NG_TEST_SUITE} ${this.reset}`);
109+
this.writeFile(`Total : ${this.bold}${this.cyan}${this.total}${this.reset}`)
110+
this.writeFile(`Passed : ${this.bold}${this.cyan}${passed}${this.reset}`)
111+
this.writeFile(`Failed : ${this.bold}${this.red}${this.failed.length}${this.reset}`)
112+
this.writeFile(`Skipped : ${this.bold}${this.yellow}${this.skipped}${this.reset}`)
113+
114+
if (this.failed.length === 0) {
115+
fs.appendFileSync(this.file, 'All tests passed\n')
116+
} else {
117+
this.writeFile('Test failures:');
118+
this.failed.forEach(f => {
119+
this.writeFile(`${this.red}${this.bold} - ${f.fullName}${this.reset}`);
120+
const logs = f.log || [];
121+
logs.forEach(l => fs.appendFileSync(this.file, `${this.grey} ${l}${this.reset}`));
122+
// Add empty line
123+
this.writeFile('');
124+
});
125+
}
126+
127+
// Update running totals JSON
128+
this.runningTotals.total += this.total;
129+
this.runningTotals.passed += passed;
130+
this.runningTotals.failed += this.failed.length;
131+
this.runningTotals.skipped += this.skipped;
132+
fs.writeFileSync(this.jsonFile, JSON.stringify(this.runningTotals));
133+
134+
this.generateSummary();
135+
136+
// Write exit code
137+
let newExitCode = this.exitCode;
138+
if (result.exitCode > 0) {
139+
newExitCode = result.exitCode
140+
}
141+
142+
fs.writeFileSync(this.exitCodeFile, newExitCode.toString());
143+
144+
// Dump the summary for this test suite
145+
var contents = fs.readFileSync(this.file, 'utf8');
146+
console.log(contents);
147+
148+
} catch (e) {
150149
console.log('ERROR while reporting test result');
151150
console.log(e);
152151
}

0 commit comments

Comments
 (0)