Template strings, without the superfluous whitespace.
The indenation is readjusted to be level with whatever the first line's indentation is. Leading and trailing whitespace is also removed (blanks and newlines).
const preformatted = require("./preformatted.js");
describe("SHARED: Preformatted", function() {
it("demonstration", function() {
const animal = "cat";
const sound = "meow";
const normalTemplateString = `
The ${animal} goes
'${sound}'
`;
console.log();
console.log("Normal template string:");
console.log(normalTemplateString);
const preformattedTemplateString = preformatted`
The ${animal} goes
'${sound}'
`;
console.log("Preformatted template string:");
console.log(preformattedTemplateString);
});
});gives:
Normal template string:
The cat goes
'meow'
Preformatted template string:
The cat goes
'meow'npm install --save-exact @chooie/preformatted
- Copy
generated/dist/client/bundle.jsto your project and include it in a script tag on the desired page - If using Browserify, you can include the source at
src/application/shared/preformatted.js
View the available tasks to run
./tasks.sh./docker-tasks.sh-
Install docker (I'm running 18.03.0-ce-mac60)
-
Start the Karma server
./docker-tasks.sh karma
-
Capture the browsers you want to test by visiting http://localhost:9876
-
Run all the checks
./docker-tasks.sh test:all
-
Start the application
./docker-tasks.sh run
In order to perform cross-browser testing professionally, we must test our application in real browsers. The testing infrastructure checks that the expected browsers are tested. You will need to install the necessary browsers and run the necessary emulators(or test loosely - see the error message).
I recommend that you test all browsers/platforms that you intend to serve as part of the automated testing.
With this in place, make sure to start the karma server and capture each of the browsers you would like to test by visiting http://localhost:9876 (may differ if you are in an emulator - read the docs for that environment).
When limiting the mocha tests that you want to run with .skip() or .only(),
make sure to use the test:quick task first to get a passing suite (WITH NO
LIMITS SPECIFIED YET). Then limit your tests and run test:quick again.
There is something weird going on with our jake test tasks, mocha, and/or karma
that is stopping this from working properly (like with test:all).
Much of the inspiration and implementation is borrowed from James Shore (https://github.com/jamesshore). I highly recommend his webseries Let's Code Test Driven Javascript (http://www.letscodejavascript.com/).