Merge pull request #10323 from Snuffleupagus/unittestcli

Test the code as-is, in Node.js/Travis, rather than its Babel translated version
This commit is contained in:
Tim van der Meij 2018-12-02 14:56:06 +01:00 committed by GitHub
commit 9a1e51af24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -898,11 +898,12 @@ gulp.task('lib', ['buildnumber'], function () {
};
}
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 = babel.transform(content, {
sourceType: 'module',
presets: noPreset ? undefined : ['@babel/preset-env'],
presets: skipBabel ? undefined : ['@babel/preset-env'],
plugins: [
'@babel/plugin-transform-modules-commonjs',
['@babel/plugin-transform-runtime', {
@ -1057,10 +1058,10 @@ gulp.task('baseline', function (done) {
});
gulp.task('unittestcli', ['testing-pre', 'lib'], function(done) {
var args = ['JASMINE_CONFIG_PATH=test/unit/clitests.json'];
var testProcess = spawn('node_modules/.bin/jasmine', args,
{ stdio: 'inherit', });
testProcess.on('close', function (code) {
var options = ['node_modules/jasmine/bin/jasmine',
'JASMINE_CONFIG_PATH=test/unit/clitests.json'];
var jasmineProcess = spawn('node', options, { stdio: 'inherit', });
jasmineProcess.on('close', function(code) {
if (code !== 0) {
done(new Error('Unit tests failed.'));
return;

View File

@ -47,7 +47,7 @@
"yargs": "^11.1.0"
},
"scripts": {
"test": "gulp lint unittestcli externaltest"
"test": "env SKIP_BABEL=true gulp lint unittestcli externaltest"
},
"repository": {
"type": "git",