From 4331ec96155beceaf36d499fee0a26dc598384ca Mon Sep 17 00:00:00 2001 From: satanTime Date: Sun, 19 Nov 2023 12:11:23 +0100 Subject: [PATCH] feat(stackblitz.com): running examples correctly --- .stackblitzrc | 7 +++++++ karma.conf.js | 17 +++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .stackblitzrc diff --git a/.stackblitzrc b/.stackblitzrc new file mode 100644 index 00000000..36f66005 --- /dev/null +++ b/.stackblitzrc @@ -0,0 +1,7 @@ +{ + "installDependencies": true, + "startCommand": "npm start", + "env": { + "SB": "true" + } +} diff --git a/karma.conf.js b/karma.conf.js index 3fd89c16..6b7e9db7 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -2,8 +2,9 @@ // https://karma-runner.github.io/1.0/config/configuration-file.html const isCSB = !!process.env.CSB; -const isLocal = !isCSB; -const withCoverage = !isCSB && !!process.env.WITH_COVERAGE; +const isSB = !!process.env.SB; +const isLocal = !isCSB && !isSB; +const withCoverage = isLocal && !!process.env.WITH_COVERAGE; if (isLocal) { process.env.CHROME_BIN = require('puppeteer').executablePath(); @@ -42,14 +43,14 @@ module.exports = function (config) { outputFile: 'specs-junit.xml', useBrowserName: false, }, - reporters: withCoverage ? ['junit'] : isCSB ? ['kjhtml'] : ['dots', 'kjhtml'], - hostname: isCSB ? 'random-4200.csb.app' : 'localhost', - listenAddress: isCSB ? '0.0.0.0' : 'localhost', - port: isCSB ? 4200 : 9876, + reporters: withCoverage ? ['junit'] : isCSB || isSB ? ['kjhtml'] : ['dots', 'kjhtml'], + hostname: isCSB ? 'random-4200.csb.app' : isSB ? 'random.github.stackblitz.io' : 'localhost', + listenAddress: isCSB || isSB ? '0.0.0.0' : 'localhost', + port: isCSB ? 4200 : isSB ? 80 : 9876, colors: true, logLevel: config.LOG_INFO, - autoWatch: isCSB, - browsers: isCSB ? [] : ['ChromeCi'], + autoWatch: isCSB || isSB, + browsers: isCSB || isSB ? [] : ['ChromeCi'], singleRun: isLocal, }); };