paper.js/gulp/tasks/test.js

59 lines
1.7 KiB
JavaScript
Raw Normal View History

/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey
* http://juerglehni.com/ & https://puckey.studio/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
var gulp = require('gulp'),
gutil = require('gulp-util'),
qunits = require('gulp-qunits'),
runSequence = require('run-sequence');
webserver = require('gulp-webserver');
gulp.task('test', function(callback) {
runSequence(
2018-10-25 14:22:55 -04:00
'build',
'jshint'
// 'test:postbuild' // Disable tests for getting text stuff out
);
});
gulp.task('test:postbuild', ['test:phantom', 'test:node']);
gulp.task('test:phantom', ['minify:acorn'], function() {
return gulp.src('index.html', { cwd: 'test' })
.pipe(qunits({
2016-01-29 07:02:51 -05:00
checkGlobals: true,
2018-10-03 05:37:28 -04:00
timeout: 40
}));
});
gulp.task('test:node', ['minify:acorn'], function(callback) {
return gulp.src('load.js', { cwd: 'test' })
.pipe(qunits({
require: [
// To dynamically load the tests files from the sources, we need
// to require Prepro.js first.
'prepro/lib/node.js',
// Note that loading dist/paper-full.js also works in
// combination with `gulp load`, in which case Prepro.js is
// present and handles the loading transparently.
{ path: '../dist/paper-full.js', namespace: 'paper' }
],
timeout: 40
}));
});
gulp.task('test:browser', ['minify:acorn'], function() {
gulp.src('.')
.pipe(webserver({
open: '/test'
}));
});