1- var path = require ( 'path' ) ;
2- var gulp = require ( 'gulp ' ) ;
3- var babel = require ( 'gulp-babel ' ) ;
4- var del = require ( 'del ' ) ;
5- var execa = require ( 'execa ' ) ;
1+ const path = require ( 'path' ) ;
2+ const { spawn } = require ( 'child_process ' ) ;
3+ const gulp = require ( 'gulp' ) ;
4+ const eslint = require ( 'gulp-eslint ' ) ;
5+ const del = require ( 'del ' ) ;
66
77
8- var PACKAGE_PARENT_DIR = path . join ( __dirname , '../' ) ;
9- var PACKAGE_SEARCH_PATH = ( process . env . NODE_PATH ? process . env . NODE_PATH + path . delimiter : '' ) + PACKAGE_PARENT_DIR ;
8+ const PACKAGE_PARENT_DIR = path . join ( __dirname , '../' ) ;
9+ const PACKAGE_SEARCH_PATH = ( process . env . NODE_PATH ? process . env . NODE_PATH + path . delimiter : '' ) + PACKAGE_PARENT_DIR ;
1010
1111
1212function clean ( ) {
1313 return del ( 'lib' ) ;
1414}
1515
1616function lint ( ) {
17- var eslint = require ( 'gulp-eslint' ) ;
1817
1918 return gulp
2019 . src ( [
@@ -28,10 +27,7 @@ function lint () {
2827}
2928
3029function build ( ) {
31- return gulp
32- . src ( 'src/**/*.js' )
33- . pipe ( babel ( ) )
34- . pipe ( gulp . dest ( 'lib' ) ) ;
30+ return spawn ( 'npx tsc -p src/tsconfig.json' , { stdio : 'inherit' , shell : true } ) ;
3531}
3632
3733function ensureAuthCredentials ( ) {
@@ -44,9 +40,7 @@ function ensureAuthCredentials () {
4440function testMocha ( ) {
4541 ensureAuthCredentials ( ) ;
4642
47- var mochaCmd = path . join ( __dirname , 'node_modules/.bin/mocha' ) ;
48-
49- var mochaOpts = [
43+ const mochaOpts = [
5044 '--ui' , 'bdd' ,
5145 '--reporter' , 'spec' ,
5246 '--timeout' , typeof v8debug === 'undefined' ? 2000 : Infinity ,
@@ -57,7 +51,7 @@ function testMocha () {
5751 // to find the plugin. So this function starts mocha with proper NODE_PATH.
5852 process . env . NODE_PATH = PACKAGE_SEARCH_PATH ;
5953
60- return execa ( mochaCmd , mochaOpts , { stdio : 'inherit' } ) ;
54+ return spawn ( `npx mocha ${ mochaOpts . join ( ' ' ) } ` , { stdio : 'inherit' , shell : true } ) ;
6155}
6256
6357function testMochaRest ( ) {
@@ -75,9 +69,7 @@ function testMochaAutomate () {
7569function testTestcafe ( browsers ) {
7670 ensureAuthCredentials ( ) ;
7771
78- var testCafeCmd = path . join ( __dirname , 'node_modules/.bin/testcafe' ) ;
79-
80- var testCafeOpts = [
72+ const testCafeOpts = [
8173 browsers ,
8274 'test/testcafe/**/*test.js' ,
8375 '-s' , '.screenshots'
@@ -87,7 +79,7 @@ function testTestcafe (browsers) {
8779 // to find the plugin. So this function starts testcafe with proper NODE_PATH.
8880 process . env . NODE_PATH = PACKAGE_SEARCH_PATH ;
8981
90- return execa ( testCafeCmd , testCafeOpts , { stdio : 'inherit' } ) ;
82+ return spawn ( `npx testcafe ${ testCafeOpts . join ( ' ' ) } ` , { stdio : 'inherit' , shell : true } ) ;
9183}
9284
9385function testTestcafeRest ( ) {
@@ -105,6 +97,10 @@ function testTestcafeAutomate () {
10597exports . clean = clean ;
10698exports . lint = lint ;
10799exports . build = gulp . parallel ( gulp . series ( clean , build ) , lint ) ;
108- exports . test = gulp . series ( exports . build , testMochaRest , testMochaAutomate , testTestcafeAutomate ) ;
109- exports . testTestcafeRest = gulp . series ( exports . build , testTestcafeRest ) ;
100+
101+ exports . testMochaRest = testMochaRest ;
102+ exports . testMochaAutomate = testMochaAutomate ;
103+ exports . testTestcafeRest = gulp . series ( exports . build , testTestcafeRest ) ;
110104exports . testTestcafeAutomate = gulp . series ( exports . build , testTestcafeAutomate ) ;
105+
106+ exports . test = gulp . series ( exports . build , testMochaRest , testMochaAutomate , testTestcafeRest , testTestcafeAutomate ) ;
0 commit comments