File tree Expand file tree Collapse file tree 3 files changed +40
-4
lines changed
Expand file tree Collapse file tree 3 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,9 @@ module.exports = function(grunt) {
353353 packApp : {
354354 cmd : "npm pack" ,
355355 cwd : "__dummy__"
356+ } ,
357+ mochaNode : {
358+ cmd : "grunt simplemocha:node"
356359 }
357360 } ,
358361 multidest : {
@@ -381,6 +384,11 @@ module.exports = function(grunt) {
381384 node : {
382385 src : localCfg . nodeTestsDir + '/**/*.js'
383386 }
387+ } ,
388+ env : {
389+ nodeTests : {
390+ NODE_PATH : localCfg . outModulesDir ,
391+ }
384392 }
385393 } ) ;
386394
@@ -391,6 +399,7 @@ module.exports = function(grunt) {
391399 grunt . loadNpmTasks ( "grunt-tslint" ) ;
392400 grunt . loadNpmTasks ( "grunt-multi-dest" ) ;
393401 grunt . loadNpmTasks ( "grunt-shell" ) ;
402+ grunt . loadNpmTasks ( "grunt-env" ) ;
394403 grunt . loadNpmTasks ( "grunt-simple-mocha" ) ;
395404
396405 var cloneTasks = function ( originalTasks , taskNameSuffix )
@@ -521,9 +530,18 @@ module.exports = function(grunt) {
521530 "get-ready-packages"
522531 ] ) ) ;
523532
533+ grunt . registerTask ( "testEnv" , function ( ) {
534+ console . log ( 'fafla' , process . env . NODE_PATH ) ;
535+ //var x = require('xml')
536+ //console.log(x);
537+ } ) ;
538+
524539 grunt . registerTask ( "node-tests" , [
525540 "clean:nodeTests" ,
526541 "ts:buildNodeTests" ,
527- "simplemocha:node" ,
542+ "copy:childPackageFiles" ,
543+ "copy:jsLibs" ,
544+ "env:nodeTests" ,
545+ "exec:mochaNode" , //spawn a new process to use the new NODE_PATH
528546 ] ) ;
529547} ;
Original file line number Diff line number Diff line change 11import { assert } from "chai" ;
2+ import { XmlParser , ParserEvent , ParserEventType } from 'xml' ;
3+ //import xml = require('xml');
24
3- describe ( "test" , ( ) => {
4- it ( "dummy" , ( ) => {
5- assert . equal ( 1 , 2 ) ;
5+ describe ( "xml parser" , ( ) => {
6+ it ( "parses simple element" , ( ) => {
7+ let attributes = null ;
8+ let element = null ;
9+
10+ var parser = new XmlParser ( function ( event : ParserEvent ) {
11+ switch ( event . eventType ) {
12+ case ParserEventType . StartElement :
13+ element = event . elementName ;
14+ attributes = event . attributes ;
15+ break ;
16+ }
17+ } ) ;
18+
19+ parser . parse ( "<TextField text='hello' />" ) ;
20+
21+ assert . equal ( 'TextField' , element ) ;
22+ assert . equal ( 'hello' , attributes [ 'text' ] ) ;
623 } ) ;
724} ) ;
Original file line number Diff line number Diff line change 2323 "grunt-tslint" : " 0.4.2" ,
2424 "mocha" : " 2.2.5" ,
2525 "grunt-simple-mocha" : " 0.4.0" ,
26+ "grunt-env" : " 0.4.4" ,
2627 "chai" : " 2.3.0" ,
2728 "typescript" : " 1.5.0-beta"
2829 }
You can’t perform that action at this time.
0 commit comments