@@ -87,3 +87,39 @@ test('error handling', function (t) {
8787 t . equal ( code , 2 , 'exit code was 2' )
8888 } )
8989} )
90+
91+ test ( 'glsl-transform' , function ( t ) {
92+ const wpack = which . sync ( 'webpack' , { cwd : __dirname } )
93+ const output = path . join ( __dirname , 'fixtures' , 'glsl' , 'bundle.js' )
94+ const config = path . join ( __dirname , 'fixtures' , 'glsl' , 'webpack.config.js' )
95+ const fixture = path . join ( __dirname , 'fixtures' , 'glsl' , 'output.txt' )
96+
97+ t . plan ( 1 )
98+
99+ try {
100+ fs . unlinkSync ( output )
101+ } catch ( e ) { }
102+
103+ spawn ( wpack , [
104+ '--module-bind' , 'js=' + __dirname ,
105+ '--config' ,
106+ config
107+ ] , {
108+ cwd : path . join ( __dirname , 'fixtures' , 'glsl' ) ,
109+ stdio : [ 'pipe' , 'pipe' , 2 ]
110+ } ) . once ( 'exit' , function ( ) {
111+ const result = fs . readFileSync ( output , { encoding : 'utf8' } )
112+
113+ fs . unlinkSync ( output )
114+
115+ vm . runInNewContext ( result , {
116+ console : {
117+ log : function ( shader ) {
118+ const expected = fs . readFileSync ( fixture , { encoding : 'utf8' } )
119+ t . equal ( shader + '\n' , expected , 'processed brfs from package.json' )
120+ }
121+ }
122+ } )
123+ } )
124+ } )
125+
0 commit comments