chore: fix integration tests
This commit is contained in:
@@ -3,7 +3,6 @@ before_install:
|
||||
- npm install -g grunt-cli
|
||||
script:
|
||||
- grunt --stack travis
|
||||
- integration-testing/run-integration-tests.sh
|
||||
email:
|
||||
on_failure: change
|
||||
on_success: never
|
||||
|
||||
+9
-2
@@ -17,7 +17,7 @@ module.exports = function(grunt) {
|
||||
]
|
||||
},
|
||||
|
||||
clean: ['tmp', 'dist', 'lib/handlebars/compiler/parser.js'],
|
||||
clean: ['tmp', 'dist', 'lib/handlebars/compiler/parser.js', 'integration-testing/**/node_modules'],
|
||||
|
||||
copy: {
|
||||
dist: {
|
||||
@@ -192,7 +192,13 @@ module.exports = function(grunt) {
|
||||
cmd: 'npm run checkTypes',
|
||||
bg: false,
|
||||
fail: true
|
||||
},
|
||||
integrationTests: {
|
||||
cmd: './integration-testing/run-integration-tests.sh',
|
||||
bg: false,
|
||||
fail: true
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
watch: {
|
||||
@@ -241,8 +247,9 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('bench', ['metrics']);
|
||||
grunt.registerTask('sauce', process.env.SAUCE_USERNAME ? ['tests', 'connect', 'saucelabs-mocha'] : []);
|
||||
|
||||
grunt.registerTask('travis', process.env.PUBLISH ? ['default', 'sauce', 'metrics', 'publish:latest'] : ['default']);
|
||||
grunt.registerTask('travis', process.env.PUBLISH ? ['default', 'bgShell:integrationTests', 'sauce', 'metrics', 'publish:latest'] : ['default']);
|
||||
|
||||
grunt.registerTask('dev', ['clean', 'connect', 'watch']);
|
||||
grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
|
||||
grunt.registerTask('integration-tests', ['default', 'bgShell:integrationTests']);
|
||||
};
|
||||
|
||||
@@ -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
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
npm install
|
||||
npm test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user