mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	NVM takes a specific node version and installs the node package and a corresponding compatible npm package. We use it in a somewhat hackish way to install node/npm globally with a pinned version, since that's how we actually want to consume node in our development environment. Other details: - Travis CI now is configured to use the version of node installed by provision; the easiest way to do this was to sabotage the existing node installation. - jsdom is upgraded to a current version, which both requires recent node and also is required for the tests to pass with recent node. This fixes running the node tests on Xenial. Fixes #1498. [tweaked by tabbott]
		
			
				
	
	
		
			38 lines
		
	
	
		
			924 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			924 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
set -e
 | 
						|
 | 
						|
cd "$(dirname "$0")"/..
 | 
						|
 | 
						|
export NODE_PATH=static
 | 
						|
export PATH=$PATH:node_modules/.bin
 | 
						|
 | 
						|
INDEX_JS=frontend_tests/zjsunit/index.js
 | 
						|
ret=0
 | 
						|
 | 
						|
if [ "$1" = "cover" ]; then
 | 
						|
  # Run a coverage test with Istanbul.
 | 
						|
  istanbul cover "$INDEX_JS" --dir var/node-coverage || ret=1;
 | 
						|
 | 
						|
elif [ "$1" = "-h" -o "$1" = "--help" ]; then
 | 
						|
  echo "Usage:
 | 
						|
`basename $0`                      - to run all tests
 | 
						|
`basename $0` util.js              - to run tests from util.js
 | 
						|
`basename $0` util.js activity.js  - to run tests from util.js and activity.js
 | 
						|
`basename $0` cover                - to run tests and generate code coverage
 | 
						|
"
 | 
						|
  exit 0
 | 
						|
 | 
						|
else
 | 
						|
  # Normal testing, no coverage analysis.
 | 
						|
  # Run the index.js test runner, which runs all the other tests.
 | 
						|
  node --stack-trace-limit=100 "$INDEX_JS" $@ || ret=1;
 | 
						|
fi
 | 
						|
 | 
						|
if [ $ret = '0' ]; then
 | 
						|
    echo "Test(s) passed. SUCCESS!"
 | 
						|
else
 | 
						|
    echo "FAIL - Test(s) failed"
 | 
						|
fi
 | 
						|
 | 
						|
exit $ret
 |