Test the code as-is, in Node.js/Travis, rather than its Babel translated version
This patch does three things: - Updates the `gulp unittestcli` command, using `gulp lint` as a guide, such that it can be run locally on Windows without any modifications. - Updates the `gulp lib` command to support disabling of Babel through the `SKIP_BABEL` environment variable. Note that all other build targets support this mode, and there's no good reason for `lib` to be any different here. - Updates the `npm test` command, used in Node.js/Travis, to test the code as-is test. Since modern Node.js versions seem to have no problems with ES6 compatible code in general, we should just test the source code as-is instead (similar to the tests running on the regular bots).
This commit is contained in:
parent
c91f437eaa
commit
08584efdfe
13
gulpfile.js
13
gulpfile.js
@ -898,11 +898,12 @@ gulp.task('lib', ['buildnumber'], function () {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
function preprocess(content) {
|
function preprocess(content) {
|
||||||
var noPreset = /\/\*\s*no-babel-preset\s*\*\//.test(content);
|
var skipBabel = process.env['SKIP_BABEL'] === 'true' ||
|
||||||
|
/\/\*\s*no-babel-preset\s*\*\//.test(content);
|
||||||
content = preprocessor2.preprocessPDFJSCode(ctx, content);
|
content = preprocessor2.preprocessPDFJSCode(ctx, content);
|
||||||
content = babel.transform(content, {
|
content = babel.transform(content, {
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
presets: noPreset ? undefined : ['@babel/preset-env'],
|
presets: skipBabel ? undefined : ['@babel/preset-env'],
|
||||||
plugins: [
|
plugins: [
|
||||||
'@babel/plugin-transform-modules-commonjs',
|
'@babel/plugin-transform-modules-commonjs',
|
||||||
['@babel/plugin-transform-runtime', {
|
['@babel/plugin-transform-runtime', {
|
||||||
@ -1057,10 +1058,10 @@ gulp.task('baseline', function (done) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('unittestcli', ['testing-pre', 'lib'], function(done) {
|
gulp.task('unittestcli', ['testing-pre', 'lib'], function(done) {
|
||||||
var args = ['JASMINE_CONFIG_PATH=test/unit/clitests.json'];
|
var options = ['node_modules/jasmine/bin/jasmine',
|
||||||
var testProcess = spawn('node_modules/.bin/jasmine', args,
|
'JASMINE_CONFIG_PATH=test/unit/clitests.json'];
|
||||||
{ stdio: 'inherit', });
|
var jasmineProcess = spawn('node', options, { stdio: 'inherit', });
|
||||||
testProcess.on('close', function (code) {
|
jasmineProcess.on('close', function(code) {
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
done(new Error('Unit tests failed.'));
|
done(new Error('Unit tests failed.'));
|
||||||
return;
|
return;
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
"yargs": "^11.1.0"
|
"yargs": "^11.1.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "gulp lint unittestcli externaltest"
|
"test": "env SKIP_BABEL=true gulp lint unittestcli externaltest"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user