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:
commit
9a1e51af24
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