File tree 3 files changed +32
-2
lines changed
3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -190,9 +190,10 @@ module.exports = function(grunt) {
190
190
// Handle async / await in Rollup build for tests
191
191
// Remove this when Node 6 is no longer supported for the build/test process
192
192
const nodeVersion = semver . major ( process . versions . node ) ;
193
+ const tsNodeRuntime = path . resolve ( path . join ( 'node_modules' , '.bin' , 'ts-node' ) ) ;
193
194
let scriptRuntime = 'node' ;
194
195
if ( nodeVersion < 8 ) {
195
- scriptRuntime = path . resolve ( path . join ( 'node_modules' , '.bin' , 'ts-node' ) ) ;
196
+ scriptRuntime = tsNodeRuntime ;
196
197
}
197
198
198
199
// Project configuration.
@@ -228,7 +229,10 @@ module.exports = function(grunt) {
228
229
command : scriptRuntime + " build/rollup.js --browser --out=./tmp/browser/less.min.js"
229
230
} ,
230
231
test : {
231
- command : "node test/index.js"
232
+ command : [
233
+ tsNodeRuntime + " test/test-es6.ts" ,
234
+ "node test/index.js"
235
+ ] . join ( ' && ' )
232
236
} ,
233
237
generatebrowser : {
234
238
command : 'node test/browser/generator/generate.js'
Original file line number Diff line number Diff line change @@ -88,5 +88,14 @@ export default (environment, fileManagers) => {
88
88
}
89
89
}
90
90
91
+ /**
92
+ * Some of the functions assume a `this` context of the API object,
93
+ * which causes it to fail when wrapped for ES6 imports.
94
+ *
95
+ * An assumed `this` should be removed in the future.
96
+ */
97
+ initial . parse = initial . parse . bind ( api ) ;
98
+ initial . render = initial . render . bind ( api ) ;
99
+
91
100
return api ;
92
101
} ;
Original file line number Diff line number Diff line change
1
+ // https://github.com/less/less.js/issues/3533
2
+ console . log ( 'Testing ES6 imports...' )
3
+
4
+ import less from '..' ;
5
+ let lessRender = less . render ;
6
+
7
+ // then I call lessRender on something
8
+ let y = lessRender ( `
9
+ body {
10
+ a: 1;
11
+ b: 2;
12
+ c: 30;
13
+ d: 4;
14
+ }` , { sourceMap : { } } , function ( error , output ) {
15
+ if ( error )
16
+ console . error ( error )
17
+ } )
You can’t perform that action at this time.
0 commit comments