'Creating a typescript test package which can be used as a package

I have created a test automation ts project which runs mocha tests through the command:

npm run start

Where the start script is an alias to:

ts-mocha -p tsconfig.json src/tests/*.test.ts --timeout 30000 --exit

My goal is to take this test automation package, and use it independently from another machine (for example to run it in a CI process without checking out the code), something like this call:

npx automation-package test

Will result in running the exact same ts-mocha script in the original package.

I've read about adding commands in package.json that can be used externally by adding the script in package.json:

"bin": {"lib/index.ts"}

But how can I run applicatively the ts-mocha command. I believe that I miss something here or there is just no way to do what I intend doing.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source