Skip to content

Commit 1adaadb

Browse files
authored
3.11.0 (#3468)
* Move transpilation from Babel to TypeScript * Update tests to Mocha / Chai / Headless Chrome * Remove old Jasmine files * Fix plugin tests cross-platform * Add new build * Fix errors for Node 8 * Remove PhantomJS references and libs * Remove unnecessary less-node file caching * Add browser benchmark comparison test * Add browser benchmark comparison test * Dist files
1 parent fd66e44 commit 1adaadb

File tree

118 files changed

+37419
-41171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+37419
-41171
lines changed

.travis.yml

-20
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,13 @@
11
language: node_js
2-
cache:
3-
directories:
4-
- travis-phantomjs
52
node_js:
63
- "12"
74
- "10"
85
- "8"
9-
before_install:
10-
# from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-177592725
11-
# and also from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-200965782
12-
- phantomjs --version
13-
- export PATH=$PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH
14-
- phantomjs --version
15-
# Clear cache and download new copy of PhantomJS if the current version doesn't match 2.1.1.
16-
- "if [ $(phantomjs --version) != '2.1.1' ]; then rm -rf $PWD/travis-phantomjs; mkdir -p $PWD/travis-phantomjs; fi"
17-
- "if [ $(phantomjs --version) != '2.1.1' ]; then wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2; fi"
18-
- "if [ $(phantomjs --version) != '2.1.1' ]; then tar -xvf $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs; fi"
19-
- phantomjs --version
206
install:
217
- npm install -g grunt-cli
22-
# node 0.10 & 0.12 have race condition issues when running custom install scripts
23-
# this can cause phantomjs-prebuilt install script to fail with the error:
24-
# <Cannot find module 'boom'>
25-
# Seems related to: https://github.com/npm/npm/issues/8152
26-
# using <travis_retry> solves this.
278
- travis_retry npm install
289
env:
2910
global:
30-
- PHANTOMJS_CDNURL=http://cnpmjs.org/downloads
3111
- secure: TrNVruWYaUK5ALga1y7wRY+MLjWJECUSCsBmKW5EUmIevOUxqHWu7M89FANKxstEeFRRAGH3QJbloRxnzIgh0U0ah5npE9XA1bYXGO5khoXeIyk7pNRfjIo8aEnJH1Vp8vWA6J6ovxdJ7lCFKEGvGKxGde50knVl7KFVVULlX2U=
3212
- secure: Rzh+CEI7YRvvVkOruPE8Z0dkU0s13V6b6cpqbN72vxbJl/Jm5PUZkjTFJdkWJrW3ErhCKX6EC7XdGvrclqEA9WAqKzrecqCJYqTnw4MwqiAj6F9wqE/BqhoWg4xPxm0MK/7eJMvLCgjNpe+gc1CaeFJZkLSNWn6nOFke+vVlf9Q=
3313
sudo: false

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ _Pull requests are encouraged!_
3535
* Start by adding a feature request to get feedback and see how your idea is received.
3636
* If your pull request solves an existing issue, but it's different in some way, _please create a new issue_ and make sure to discuss it with the core contributors. Otherwise you risk your hard work being rejected.
3737
* Do not change the **./dist/** folder, we do this when releasing
38-
* _Please add tests_ for your work. Tests are invoked using `npm test` command. It will run both node.js tests and browser ([PhantomJS](http://phantomjs.org/)) tests.
38+
* _Please add tests_ for your work. Tests are invoked using `npm test` command. It will run both node.js tests and browser (Headless Chrome) tests.
3939

4040
### Coding Standards
4141

4242
* Always use spaces, never tabs
4343
* End lines in semi-colons.
44-
* Loosely aim towards jsHint standards
44+
* Loosely aim towards eslint standards
4545

4646

4747
## Developing

Gruntfile.js

+27-207
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ module.exports = function(grunt) {
186186
const nodeVersion = semver.major(process.versions.node);
187187
let scriptRuntime = 'node';
188188
if (nodeVersion < 8) {
189-
scriptRuntime = path.resolve(path.join('node_modules', '.bin', 'babel-node')) + ' --presets=@babel/env';
189+
scriptRuntime = path.resolve(path.join('node_modules', '.bin', 'ts-node'));
190190
}
191191

192192
// Project configuration.
@@ -206,21 +206,30 @@ module.exports = function(grunt) {
206206
command: [
207207
scriptRuntime + " build/rollup.js --lessc --out=./tmp/lessc",
208208
scriptRuntime + " build/rollup.js --node --out=./tmp/less.cjs.js",
209-
scriptRuntime + " build/rollup.js --browser --out=./test/browser/less.min.js"
209+
scriptRuntime + " build/rollup.js --browser --out=./tmp/browser/less.min.js"
210210
].join(" && ")
211211
},
212212
testcjs: {
213213
command: scriptRuntime + " build/rollup.js --node --out=./tmp/less.cjs.js"
214214
},
215215
testbrowser: {
216-
command: scriptRuntime + " build/rollup.js --browser --out=./test/browser/less.min.js"
216+
command: scriptRuntime + " build/rollup.js --browser --out=./tmp/browser/less.min.js"
217217
},
218218
test: {
219219
command: "node test/index.js"
220220
},
221+
generatebrowser: {
222+
command: 'node test/browser/generator/generate.js'
223+
},
224+
runbrowser: {
225+
command: 'node test/browser/generator/runner.js'
226+
},
221227
benchmark: {
222228
command: "node benchmark/index.js"
223229
},
230+
benchmarkbrowser: {
231+
command: "node test/browser/generator/runner.js benchmark"
232+
},
224233
opts: {
225234
// test running with all current options (using `opts` since `options` means something already)
226235
command: [
@@ -277,201 +286,7 @@ module.exports = function(grunt) {
277286
}
278287
},
279288

280-
jasmine: {
281-
options: {
282-
keepRunner: true,
283-
host: "http://localhost:8081/",
284-
polyfills: [
285-
"./node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js",
286-
"test/browser/vendor/promise.js"
287-
],
288-
vendor: [
289-
"test/browser/vendor/jasmine-jsreporter.js",
290-
"test/browser/common.js",
291-
"test/browser/less.min.js"
292-
],
293-
template: "test/browser/test-runner-template.tmpl"
294-
},
295-
main: {
296-
// src is used to build list of less files to compile
297-
src: [
298-
"test/less/*.less",
299-
"!test/less/plugin-preeval.less", // uses ES6 syntax
300-
// Don't test NPM import, obviously
301-
"!test/less/plugin-module.less",
302-
"!test/less/import-module.less",
303-
"!test/less/javascript.less",
304-
"!test/less/urls.less",
305-
"!test/less/empty.less"
306-
],
307-
options: {
308-
helpers: "test/browser/runner-main-options.js",
309-
specs: "test/browser/runner-main-spec.js",
310-
outfile: "tmp/browser/test-runner-main.html"
311-
}
312-
},
313-
legacy: {
314-
src: ["test/less/legacy/*.less"],
315-
options: {
316-
helpers: "test/browser/runner-legacy-options.js",
317-
specs: "test/browser/runner-legacy-spec.js",
318-
outfile: "tmp/browser/test-runner-legacy.html"
319-
}
320-
},
321-
strictUnits: {
322-
src: ["test/less/strict-units/*.less"],
323-
options: {
324-
helpers: "test/browser/runner-strict-units-options.js",
325-
specs: "test/browser/runner-strict-units-spec.js",
326-
outfile: "tmp/browser/test-runner-strict-units.html"
327-
}
328-
},
329-
errors: {
330-
src: [
331-
"test/less/errors/*.less",
332-
"!test/less/errors/javascript-error.less",
333-
"test/browser/less/errors/*.less"
334-
],
335-
options: {
336-
timeout: 20000,
337-
helpers: "test/browser/runner-errors-options.js",
338-
specs: "test/browser/runner-errors-spec.js",
339-
outfile: "tmp/browser/test-runner-errors.html"
340-
}
341-
},
342-
noJsErrors: {
343-
src: ["test/less/no-js-errors/*.less"],
344-
options: {
345-
helpers: "test/browser/runner-no-js-errors-options.js",
346-
specs: "test/browser/runner-no-js-errors-spec.js",
347-
outfile: "tmp/browser/test-runner-no-js-errors.html"
348-
}
349-
},
350-
browser: {
351-
src: [
352-
"test/browser/less/*.less",
353-
"test/browser/less/plugin/*.less"
354-
],
355-
options: {
356-
helpers: "test/browser/runner-browser-options.js",
357-
specs: "test/browser/runner-browser-spec.js",
358-
outfile: "tmp/browser/test-runner-browser.html"
359-
}
360-
},
361-
relativeUrls: {
362-
src: ["test/browser/less/relative-urls/*.less"],
363-
options: {
364-
helpers: "test/browser/runner-relative-urls-options.js",
365-
specs: "test/browser/runner-relative-urls-spec.js",
366-
outfile: "tmp/browser/test-runner-relative-urls.html"
367-
}
368-
},
369-
rewriteUrls: {
370-
src: ["test/browser/less/rewrite-urls/*.less"],
371-
options: {
372-
helpers: "test/browser/runner-rewrite-urls-options.js",
373-
specs: "test/browser/runner-rewrite-urls-spec.js",
374-
outfile: "tmp/browser/test-runner-rewrite-urls.html"
375-
}
376-
},
377-
rootpath: {
378-
src: ["test/browser/less/rootpath/*.less"],
379-
options: {
380-
helpers: "test/browser/runner-rootpath-options.js",
381-
specs: "test/browser/runner-rootpath-spec.js",
382-
outfile: "tmp/browser/test-runner-rootpath.html"
383-
}
384-
},
385-
rootpathRelative: {
386-
src: ["test/browser/less/rootpath-relative/*.less"],
387-
options: {
388-
helpers: "test/browser/runner-rootpath-relative-options.js",
389-
specs: "test/browser/runner-rootpath-relative-spec.js",
390-
outfile: "tmp/browser/test-runner-rootpath-relative.html"
391-
}
392-
},
393-
rootpathRewriteUrls: {
394-
src: ["test/browser/less/rootpath-rewrite-urls/*.less"],
395-
options: {
396-
helpers:
397-
"test/browser/runner-rootpath-rewrite-urls-options.js",
398-
specs: "test/browser/runner-rootpath-rewrite-urls-spec.js",
399-
outfile:
400-
"tmp/browser/test-runner-rootpath-rewrite-urls.html"
401-
}
402-
},
403-
production: {
404-
src: ["test/browser/less/production/*.less"],
405-
options: {
406-
helpers: "test/browser/runner-production-options.js",
407-
specs: "test/browser/runner-production-spec.js",
408-
outfile: "tmp/browser/test-runner-production.html"
409-
}
410-
},
411-
modifyVars: {
412-
src: ["test/browser/less/modify-vars/*.less"],
413-
options: {
414-
helpers: "test/browser/runner-modify-vars-options.js",
415-
specs: "test/browser/runner-modify-vars-spec.js",
416-
outfile: "tmp/browser/test-runner-modify-vars.html"
417-
}
418-
},
419-
globalVars: {
420-
src: ["test/browser/less/global-vars/*.less"],
421-
options: {
422-
helpers: "test/browser/runner-global-vars-options.js",
423-
specs: "test/browser/runner-global-vars-spec.js",
424-
outfile: "tmp/browser/test-runner-global-vars.html"
425-
}
426-
},
427-
postProcessorPlugin: {
428-
src: ["test/less/postProcessorPlugin/*.less"],
429-
options: {
430-
helpers: [
431-
"test/plugins/postprocess/index.js",
432-
"test/browser/runner-postProcessorPlugin-options.js"
433-
],
434-
specs: "test/browser/runner-postProcessorPlugin.js",
435-
outfile:
436-
"tmp/browser/test-runner-post-processor-plugin.html"
437-
}
438-
},
439-
preProcessorPlugin: {
440-
src: ["test/less/preProcessorPlugin/*.less"],
441-
options: {
442-
helpers: [
443-
"test/plugins/preprocess/index.js",
444-
"test/browser/runner-preProcessorPlugin-options.js"
445-
],
446-
specs: "test/browser/runner-preProcessorPlugin.js",
447-
outfile: "tmp/browser/test-runner-pre-processor-plugin.html"
448-
}
449-
},
450-
visitorPlugin: {
451-
src: ["test/less/visitorPlugin/*.less"],
452-
options: {
453-
helpers: [
454-
"test/plugins/visitor/index.js",
455-
"test/browser/runner-VisitorPlugin-options.js"
456-
],
457-
specs: "test/browser/runner-VisitorPlugin.js",
458-
outfile: "tmp/browser/test-runner-visitor-plugin.html"
459-
}
460-
},
461-
filemanagerPlugin: {
462-
src: ["test/less/filemanagerPlugin/*.less"],
463-
options: {
464-
helpers: [
465-
"test/plugins/filemanager/index.js",
466-
"test/browser/runner-filemanagerPlugin-options.js"
467-
],
468-
specs: "test/browser/runner-filemanagerPlugin.js",
469-
outfile: "tmp/browser/test-runner-filemanager-plugin.html"
470-
}
471-
}
472-
},
473-
474-
"saucelabs-jasmine": sauceJobs,
289+
"saucelabs-mocha": sauceJobs,
475290

476291
// Clean the version of less built for the tests
477292
clean: {
@@ -506,13 +321,13 @@ module.exports = function(grunt) {
506321
grunt.registerTask("browsertest", [
507322
"browsertest-lessjs",
508323
"connect",
509-
"jasmine"
324+
"shell:runbrowser"
510325
]);
511326

512327
// setup a web server to run the browser tests in a browser rather than phantom
513328
grunt.registerTask("browsertest-server", [
514329
"browsertest-lessjs",
515-
"jasmine::build",
330+
"shell:generatebrowser",
516331
"connect::keepalive"
517332
]);
518333

@@ -530,13 +345,13 @@ module.exports = function(grunt) {
530345

531346
grunt.registerTask("sauce", [
532347
"browsertest-lessjs",
533-
"jasmine::build",
348+
"shell:generatebrowser",
534349
"connect",
535350
"sauce-after-setup"
536351
]);
537352

538353
grunt.registerTask("sauce-after-setup", [
539-
"saucelabs-jasmine:all",
354+
"saucelabs-mocha:all",
540355
"clean:sauce_log"
541356
]);
542357

@@ -548,14 +363,12 @@ module.exports = function(grunt) {
548363
"shell:opts",
549364
"shell:plugin",
550365
"connect",
551-
"jasmine"
366+
"shell:runbrowser"
552367
];
553368

554369
if (
555370
isNaN(Number(process.env.TRAVIS_PULL_REQUEST, 10)) &&
556-
Number(process.env.TRAVIS_NODE_VERSION) === 4 &&
557-
(process.env.TRAVIS_BRANCH === "master" ||
558-
process.env.TRAVIS_BRANCH === "3.x")
371+
(process.env.TRAVIS_BRANCH === "master")
559372
) {
560373
testTasks.push("force:on");
561374
testTasks.push("sauce-after-setup");
@@ -586,8 +399,15 @@ module.exports = function(grunt) {
586399
]);
587400

588401
// Run benchmark
589-
grunt.registerTask("benchmark", [
402+
grunt.registerTask("benchmark-node", [
590403
"shell:testcjs",
591404
"shell:benchmark"
592405
]);
406+
407+
// Run all browser tests
408+
grunt.registerTask("benchmark", [
409+
"browsertest-lessjs",
410+
"connect",
411+
"shell:benchmarkbrowser"
412+
]);
593413
};

appveyor.yml

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ install:
1313
# <Cannot find module 'boom'>
1414
# Seems related to: https://github.com/npm/npm/issues/8152
1515
# using <appveyor_retry> solves this.
16+
17+
# change now that we're not using phantomjs?
1618
- appveyor-retry call npm install
1719

1820
# Grunt-specific stuff.

0 commit comments

Comments
 (0)