Package Exports
- @knapsack-pro/core
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@knapsack-pro/core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@knapsack-pro/core
@knapsack-pro/core is JS npm package with core features for Knapsack Pro API.
Learn how to run your tests faster with optimal test suite parallelisation using Knapsack Pro.
Table of Contents
FAQ
How to change log level?
You can set log level with environment variable KNAPSACK_PRO_LOG_LEVEL.
The default level is info.
Available log levels (from most important to least important):
error- shows only critical errorswarn- shows warnings (e.g. Fallback Mode has started)info- shows Knapsack Pro API request response bodyverbosedebug- shows Knapsack Pro API request headers and bodysilly
What happens when Knapsack Pro API is not available? How Fallback Mode works?
When Knapsack Pro API is not available or temporarily unreachable due to network problems then Fallback Mode will be started and you will see a log warning in the output.
In Fallback Mode your tests will be executed and split based on test file names across CI nodes. If in the meantime other CI nodes were able to connect to Knapsack Pro API then you may notice that some of the test files were executed twice across CI nodes. Fallback Mode guarantees each of test files is run at least once as a part of CI build.
If during CI build runtime connection to Knapsack Pro API is lost, Fallback Mode would run tests except those executed so far.
Development
Setup
Install dependencies:
$ npm installCompile TypeScript code to
libdirectory by running:$ npm startRegister
@knapsack-pro/corepackage globally in your local system. This way we will be able to develop other npm packages dependent on it:$ npm linkSet up your IDE:
WebStorm / PhpStorm
Install the following plugins:
Go to
File > Settings > Languages & Frameworks > JavaScript > Code Quality Tools > ESLintTurn on
Enablecheckbox.Go to
File > Settings > Languages & Frameworks > TypeScript > TSLintTurn on
Enablecheckbox.Go to
File > Settings > Tools > File WatchersClick
Importbutton and selectwatchers.xmlfile from the repository.
Visual Studio Code
Install the following plugins:
Go to
File > Preferences > Settings > Extensions > Prettier - Code formatterTurn on
Prettier: Eslint Integrationcheckbox. Turn onPrettier: Tslint Integrationcheckbox.Go to
File > Preferences > Settings > Text Editor > FormattingTurn on
Format On Savecheckbox.
From now on every change in code base will be automatically formatted by Prettier. ESLint and TSLint errors will be also automatically fixed on every file save.
Write some code.
Publishing
Sign in to npm registry with command:
$ npm adduserBefore releasing a new version of package please update
CHANGELOG.mdwith github_changelog_generator:$ gem install github_changelog_generator # generate CHANGELOG.md $ github_changelog_generator KnapsackPro/knapsack-pro-core-js $ git commit -am "Update CHANGELOG.md" $ git push origin masterIf you have added new files to the repository and they should be part of the released npm package then please ensure they are included in
filesarray inpackage.json.If you have changed any headers in
README.mdplease refresh table of contents with:$ npm run doctocCompile project:
$ npm run buildIn order to bump version of the package run below command. It will also create a version commit and tag for the release:
# bump patch version 0.0.x $ npm version patch # bump minor version 0.x.0 $ npm version minorPush to git repository created commit and tag:
$ git push origin master --tagsNow when git tag is on Github you can update
CHANGELOG.mdagain.$ github_changelog_generator KnapsackPro/knapsack-pro-core-js $ git commit -am "Update CHANGELOG.md" $ git push origin masterNow you can publish package to npm registry:
$ npm publish