@eui/tools 5.3.74 → 5.3.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 5.3.74
1
+ 5.3.75
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 5.3.75 (2022-10-20)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **karma:**
6
+ * tests - EUI-6702 [EUI-6702](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6702) ([8e8ac19f](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/8e8ac19f20f4ae7b042d56c74a558471094c5707))
7
+
8
+ * * *
9
+ * * *
1
10
  ## 5.3.74 (2022-10-20)
2
11
 
3
12
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.74",
3
+ "version": "5.3.75",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -1399,6 +1399,64 @@ const tsConfigDef = {
1399
1399
  }
1400
1400
  };
1401
1401
 
1402
+ const tsConfigSpecDef = {
1403
+ "extends": "../tsconfig.json",
1404
+ "compilerOptions": {
1405
+ "baseUrl": ".",
1406
+ "outDir": "./out-tsc/spec",
1407
+ "types": [
1408
+ "jasmine",
1409
+ "node"
1410
+ ]
1411
+ },
1412
+ "include": [
1413
+ "**/*.spec.ts",
1414
+ "**/*.d.ts"
1415
+ ],
1416
+ "exclude": []
1417
+ };
1418
+
1419
+ const karmaConfDef = `
1420
+ module.exports = function (config) {
1421
+ config.set({
1422
+ basePath: '',
1423
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
1424
+ plugins: [
1425
+ require('karma-jasmine'),
1426
+ require('karma-chrome-launcher'),
1427
+ require('karma-jasmine-html-reporter'),
1428
+ require('karma-coverage'),
1429
+ require('@angular-devkit/build-angular/plugins/karma')
1430
+ ],
1431
+ client: {
1432
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
1433
+ },
1434
+ jasmineHtmlReporter: {
1435
+ suppressAll: true // removes the duplicated traces
1436
+ },
1437
+ customLaunchers: {
1438
+ MyHeadlessChrome: {
1439
+ base: 'ChromeHeadless',
1440
+ flags: [
1441
+ '--no-sandbox',
1442
+ '--remote-debugging-port=9223',
1443
+ '--disable-translate',
1444
+ '--disable-extensions'
1445
+ ]
1446
+ }
1447
+ },
1448
+ reporters: ['progress', 'kjhtml'],
1449
+ port: 9876,
1450
+ colors: true,
1451
+ logLevel: config.LOG_INFO,
1452
+ autoWatch: true,
1453
+ browsers: ['MyHeadlessChrome'],
1454
+ singleRun: false,
1455
+ restartOnFileChange: true,
1456
+ captureConsole: true
1457
+ });
1458
+ };
1459
+ `
1402
1460
  const tsConfigProdDef = {
1403
1461
  "extends": "./tsconfig.lib.json",
1404
1462
  "compilerOptions": {
@@ -1508,6 +1566,31 @@ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath, pkg
1508
1566
  projectDef = tools.replaceAll(projectDef, '@subEntry.path@', subEntryName)
1509
1567
  projectDef = tools.replaceAll(projectDef, '@subEntry.package.name@', 'ng-package.json');
1510
1568
  projectDef = tools.replaceAll(projectDef, '@tsconfig@', pkg.tsConfigFileName);
1569
+ // if tsconfig is missing add it
1570
+ const tsConfigSpecPath = path.join(process.cwd(), JSON.parse(projectDef).architect.test.options.tsConfig);
1571
+ // check if tsconfig exists otherwise created it
1572
+ if (!tools.isFileExists(tsConfigSpecPath)) {
1573
+ // determine tsconfig path
1574
+ const tsConfigFolder = JSON.parse(projectDef).architect.build.options.tsConfig.replace(/\/tsconfig.*/g, '');
1575
+ const projectFolder = JSON.parse(projectDef).architect.build.options.project.replace('/ng-package.json', '');
1576
+ const parent = projectFolder.replace(tsConfigFolder, '').split('/').length - 1;
1577
+ // calculate the parent tsconfig path
1578
+ tsConfigSpecDef.extends = '../'.repeat(parent) + 'tsconfig.json';
1579
+
1580
+ // check if parent tsconfig.json is missing
1581
+ if(!tools.isFileExists(path.join(process.cwd(), projectFolder, tsConfigSpecDef.extends))) {
1582
+ tools.logError('The tsconfig.json file is missing in the parent folder of the sub entry: ' + subEntryName);
1583
+ return;
1584
+ }
1585
+
1586
+ tools.writeJsonFileSync(tsConfigSpecPath, tsConfigSpecDef);
1587
+ }
1588
+
1589
+ // if karma.conf.js is missing add it
1590
+ const karmaConfPath = path.join(process.cwd(), JSON.parse(projectDef).architect.test.options.karmaConfig);
1591
+ if(!tools.isFileExists(karmaConfPath)) {
1592
+ tools.writeFileContent(karmaConfPath, karmaConfDef)
1593
+ }
1511
1594
 
1512
1595
  jsonFile['projects'][subEntryName] = JSON.parse(projectDef);
1513
1596
 
@@ -222,11 +222,14 @@ module.exports.buildSubEntry = (pkg, subEntry) => {
222
222
  }
223
223
  })
224
224
  .then(() => {
225
- tools.logInfo('Testing...');
226
- const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');
227
- let args = ['--max_old_space_size=8096', ng, 'test', subEntry, '--code-coverage', '--watch=false'];
228
- tools.logInfo(`running ng test : with args: ${args} on folder : ${pkg.paths.pkgRootDirectory}`);
229
- return execa('node', args, { cwd: pkg.paths.pkgRootDirectory, stdio: 'inherit' });
225
+ const { skipTest } = tools.getArgs();
226
+ if(!skipTest) {
227
+ tools.logInfo('Testing...');
228
+ const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');
229
+ let args = ['--max_old_space_size=8096', ng, 'test', subEntry, '--code-coverage', '--watch=false'];
230
+ tools.logInfo(`running ng test : with args: ${args} on folder : ${pkg.paths.pkgRootDirectory}`);
231
+ return execa('node', args, { cwd: pkg.paths.pkgRootDirectory, stdio: 'inherit' });
232
+ }
230
233
  })
231
234
  .then(() => {
232
235
  const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');