Skip to content

Conversation

@gayanW
Copy link
Contributor

@gayanW gayanW commented Nov 21, 2025

NOTE: Make sure to merge backend changes before merging CLI changes:
https://github.com/launchableinc/mothership/pull/12710

How to test

Start by creating sample Angular project with Karma and Jasmine:

The below instructions are based on:
https://angular.dev/guide/testing/karma
https://www.npmjs.com/package/karma-json-reporter

ng new my-karma-app --test-runner=karma
cd my-karma-app
npm install --save-dev karma karma-chrome-launcher karma-coverage karma-jasmine karma-jasmine-html-reporter jasmine-core @types/jasmine
ng test --no-watch --no-progress --browsers=ChromeHeadless

Configure Json reporter

npm install --save-dev karma-json-reporter
ng generate config karma

Add following to karma.conf.js while keeping the current settings:

module.exports = function (config) {
  config.set({
    ...
    plugins: [
      ...
      require('karma-json-reporter')
    ],
    jsonReporter: {
      outputFile: require('path').join(__dirname, 'test-results.json'),
      stdout: false
    },
    reporters: [..., 'json']
  });
};

Record session:

git add . && git commit -m "Initial commit"
launchable record build --name ${BUILD_NAME}
launchable record session --build ${BUILD_NAME} > session.txt

Record tests with karma:

ng test --no-watch --no-progress --browsers=ChromeHeadless
launchable record tests karma test-results.json

Subset tests with ng:

ng test --list-tests | grep src > test_list.txt
cat test_list.txt | launchable subset --target 25% ng > subset.txt

Run subset of tests

ng test --no-watch --no-progress --browsers=ChromeHeadless --include $(cat subset.txt)

If this gets merged, I'll create a sample project in smart-tests-integration-examples with a README containing the above instructions.

@gayanW gayanW requested review from kohsuke and ono-max November 21, 2025 08:59
@kohsuke kohsuke merged commit 286a6e6 into v1 Nov 21, 2025
13 checks passed
@kohsuke kohsuke deleted the LCHIB-668 branch November 21, 2025 18:14
@github-actions github-actions bot mentioned this pull request Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants