Installing a local test farm, alongside a local wiki farm.
A local wiki farm will have been installed using `npm i -g wiki`. One thing to be aware of is that wiki will look in some standard locations for its configuration file `config.json`. If your test farm is likely to be using different configurations you will want to use a different name, and pass it in on the command line. For example, I use `wiki --config ~/.wiki/config.json.safe`.
Installing a test copy, we want this to be alongside the folder of the component we are working on. For example if we are working on `somepath/wiki-client`, we want to install wiki in `somepath/test`.
Create `somepath/test`, and in that folder run `npm i wiki --install-strategy=shallow`. This will install wiki giving us the same layout in `node_modules` we get when installed globally.
cd ~/workspace/wiki/ npm i wiki --install-strategy=shallow
If using a different configuration file for testing, I create it in `somepath/test`, just to keep it separate and avoid confusion.
To run this test wiki, cd to `somepath/test/node_modules/wiki` and run `node index.js --config ~/.wiki/config.json.safe`. NB: If you want to have the local farm running at the same time, you will need to use a modified configuration and specify the port you want the test wiki to use. *You could also use `--port` to specify a port.*
cd ~/workspace/wiki/node_modules/wiki node --trace-deprecation index.js --config ~/workspace/wiki-client/config.json.safe --port 3333
Continuing our example of working on `wiki-client`, once we have make our changes we can run the available test. `npm run tests` runs those tests that can be run outside the browser, while `npm run runtest` builds and opens the browser based tests.
cd ~/workspace/wiki-client/ npm run tests npm run runtest
To install our modified client, we first need to build it `npm run build`, and then back in `somepath/test/node_modules/wiki` run `npm i $(npm pack ../../../wiki-client | tail -1)` to install it. Where `../../../wiki-client` is the relative path to where we are working on wiki-client.
cd ~/workspace/wiki/node_modules/wiki npm i $(npm pack ../../../wiki-client | tail -1)