chore: fix integration tests
This commit is contained in:
@@ -1 +1,2 @@
|
||||
target
|
||||
target
|
||||
package-lock.json
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "multi-nodejs-test",
|
||||
"version": "1.0.0",
|
||||
"description": "Simple integration test with all relevant NodeJS-versions.",
|
||||
"keywords": [],
|
||||
"author": "Nils Knappmeier",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"handlebars": "file:../.."
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node run-handlebars.js",
|
||||
"test-precompile": "handlebars precompile-test-template.txt.hbs"
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
// This test should run successfully with node 0.10 as long as Handlebars has been compiled before
|
||||
// This test should run successfully with node 0.10++ as long as Handlebars has been compiled before
|
||||
var assert = require('assert');
|
||||
var Handlebars = require('../../');
|
||||
var Handlebars = require('handlebars');
|
||||
|
||||
console.log('Testing build Handlebars with Node version ' + process.version);
|
||||
console.log('Testing built 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')
|
||||
var template = Handlebars.compile('Author: {{author}}');
|
||||
var output = template({author: 'Yehuda'});
|
||||
assert.strictEqual(output, 'Author: Yehuda');
|
||||
|
||||
console.log('Success');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$( dirname "$( readlink -f "$0" )" )" || exit 1
|
||||
# shellcheck disable=SC1090
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
|
||||
# This script tests with precompiler and the built distribution with multiple NodeJS version.
|
||||
@@ -14,10 +15,12 @@ cd "$( dirname "$( readlink -f "$0" )" )" || exit 1
|
||||
# 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
|
||||
rm target node_modules package-lock.json -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
|
||||
nvm exec "$i" npm install
|
||||
nvm exec "$i" npm run test || exit 1
|
||||
nvm exec "$i" npm run test-precompile || exit 1
|
||||
|
||||
echo Success
|
||||
done
|
||||
Reference in New Issue
Block a user