chore: fix integration tests
This commit is contained in:
@@ -3,7 +3,6 @@ before_install:
|
|||||||
- npm install -g grunt-cli
|
- npm install -g grunt-cli
|
||||||
script:
|
script:
|
||||||
- grunt --stack travis
|
- grunt --stack travis
|
||||||
- integration-testing/run-integration-tests.sh
|
|
||||||
email:
|
email:
|
||||||
on_failure: change
|
on_failure: change
|
||||||
on_success: never
|
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: {
|
copy: {
|
||||||
dist: {
|
dist: {
|
||||||
@@ -192,7 +192,13 @@ module.exports = function(grunt) {
|
|||||||
cmd: 'npm run checkTypes',
|
cmd: 'npm run checkTypes',
|
||||||
bg: false,
|
bg: false,
|
||||||
fail: true
|
fail: true
|
||||||
|
},
|
||||||
|
integrationTests: {
|
||||||
|
cmd: './integration-testing/run-integration-tests.sh',
|
||||||
|
bg: false,
|
||||||
|
fail: true
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
@@ -241,8 +247,9 @@ module.exports = function(grunt) {
|
|||||||
grunt.registerTask('bench', ['metrics']);
|
grunt.registerTask('bench', ['metrics']);
|
||||||
grunt.registerTask('sauce', process.env.SAUCE_USERNAME ? ['tests', 'connect', 'saucelabs-mocha'] : []);
|
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('dev', ['clean', 'connect', 'watch']);
|
||||||
grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
|
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 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'});
|
var template = Handlebars.compile('Author: {{author}}');
|
||||||
if (output !== 'Author: Yehuda') {
|
var output = template({author: 'Yehuda'});
|
||||||
throw new Error('Compiled output (' + compiledOutput + ') did not match expected output (' + expectedOutput + ')');
|
assert.strictEqual(output, 'Author: Yehuda');
|
||||||
}
|
|
||||||
|
|
||||||
assert.equal(output, 'Author: Yehuda')
|
|
||||||
|
|
||||||
console.log('Success');
|
console.log('Success');
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd "$( dirname "$( readlink -f "$0" )" )" || exit 1
|
cd "$( dirname "$( readlink -f "$0" )" )" || exit 1
|
||||||
|
# shellcheck disable=SC1090
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||||
|
|
||||||
# This script tests with precompiler and the built distribution with multiple NodeJS version.
|
# 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
|
# A list of NodeJS versions is expected as cli-args
|
||||||
echo "Handlebars should be able to run in various versions of NodeJS"
|
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
|
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
|
mkdir target
|
||||||
nvm install "$i"
|
nvm install "$i"
|
||||||
nvm exec "$i" node ./run-handlebars.js >/dev/null || exit 1
|
nvm exec "$i" npm install
|
||||||
nvm exec "$i" node ../../bin/handlebars precompile-test-template.txt.hbs -f target/precompile-test-template.js || exit 1
|
nvm exec "$i" npm run test || exit 1
|
||||||
|
nvm exec "$i" npm run test-precompile || exit 1
|
||||||
|
|
||||||
echo Success
|
echo Success
|
||||||
done
|
done
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
npm install
|
npm install
|
||||||
npm test
|
npm test
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user