chore: add framework for various integration tests
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
"self": false
|
||||
},
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
'no-console': 'off'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
target
|
||||
@@ -0,0 +1 @@
|
||||
Author: {{author}}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// This test should run successfully with node 0.10 as long as Handlebars has been compiled before
|
||||
var assert = require('assert');
|
||||
var Handlebars = require('../../');
|
||||
|
||||
console.log('Testing build Handlebars with Node version ' + process.version);
|
||||
|
||||
var output = Handlebars.compile('Author: {{author}}')({author: 'Yehuda'});
|
||||
if (output !== 'Author: Yehuda') {
|
||||
throw new Error('Compiled output (' + compiledOutput + ') did not match expected output (' + expectedOutput + ')');
|
||||
}
|
||||
|
||||
assert.equal(output, 'Author: Yehuda')
|
||||
|
||||
console.log('Success');
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$( dirname "$( readlink -f "$0" )" )" || exit 1
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
|
||||
# This script tests with precompiler and the built distribution with multiple NodeJS version.
|
||||
# The rest of the travis-build will only work with newer NodeJS versions, because the build
|
||||
# tools don't support older versions.
|
||||
# However, the built distribution should work with older NodeJS versions as well.
|
||||
# This test is simple by design. It merely ensures, that calling Handlebars does not fail with old versions.
|
||||
# It does (almost) not test for correctness, because that is already done in the mocha-tests.
|
||||
# And it does not use any NodeJS based testing framwork to make this part independent of the Node version.
|
||||
|
||||
# A list of NodeJS versions is expected as cli-args
|
||||
echo "Handlebars should be able to run in various versions of NodeJS"
|
||||
for i in 0.10 0.12 4 5 6 7 8 9 10 11 ; do
|
||||
rm target -rf
|
||||
mkdir target
|
||||
nvm install "$i"
|
||||
nvm exec "$i" node ./run-handlebars.js >/dev/null || exit 1
|
||||
nvm exec "$i" node ../../bin/handlebars precompile-test-template.txt.hbs -f target/precompile-test-template.js || exit 1
|
||||
echo Success
|
||||
done
|
||||
Reference in New Issue
Block a user