File tree Expand file tree Collapse file tree 4 files changed +35
-10
lines changed Expand file tree Collapse file tree 4 files changed +35
-10
lines changed Original file line number Diff line number Diff line change 1+ # Unit tests for sqlstring
2+
3+ ## Running tests on older node versions
4+
5+ We rely on Travis CI to check compatibility with older Node runtimes.
6+
7+ To locally run tests on an older runtime, for example ` 0.12 ` :
8+
9+ ``` sh
10+ $ npm install --no-save npx
11+ $ ./node_modules/.bin/npx node@0.12 test/run.js
12+ ```
Original file line number Diff line number Diff line change 1+ // A minimal file that uses ES6 features which will fail to load on
2+ // older browsers.
3+ `I load on ES6` ;
Original file line number Diff line number Diff line change 1- // If we're on a Node runtime that should support ES6, run the ES6 tests.
2- if ( / ^ v ? [ 0 - 5 ] [ . ] / . test ( process . version ) ) {
3- // The major version is a single digit in [0, 5].
4- console . info ( 'Skipping ES6 tests for node_version %s' , process . version ) ;
5- } else {
1+ var canRequireES6 = true ;
2+ try {
3+ require ( './es6/canary' ) ;
4+ } catch ( ignored ) {
5+ canRequireES6 = false ;
6+ }
7+
8+ if ( canRequireES6 ) {
69 require ( './es6/Lexer' ) ;
10+ } else {
11+ console . info ( 'Skipping ES6 tests for node_version %s' , process . version ) ;
712}
Original file line number Diff line number Diff line change @@ -2,9 +2,16 @@ var assert = require('assert');
22var SqlString = require ( '../../' ) ;
33var test = require ( 'utest' ) ;
44
5- // If we're on a Node runtime that should support ES6, run the ES6 tests.
6- if ( / ^ v ? [ 0 - 5 ] [ . ] / . test ( process . version ) ) {
7- // The major version is a single digit in [0, 5].
5+ var canRequireES6 = true ;
6+ try {
7+ require ( './es6/canary' ) ;
8+ } catch ( ignored ) {
9+ canRequireES6 = false ;
10+ }
11+
12+ if ( canRequireES6 ) {
13+ require ( './es6/Template' ) ;
14+ } else {
815 console . info ( 'Skipping ES6 tests for node_version %s' , process . version ) ;
916
1017 test ( 'Template fallback' , {
@@ -17,8 +24,6 @@ if (/^v?[0-5][.]/.test(process.version)) {
1724 } ) ;
1825 }
1926 } ) ;
20- } else {
21- require ( './es6/Template' ) ;
2227}
2328
2429var sql = SqlString . sql ;
You can’t perform that action at this time.
0 commit comments