Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/actions_upload_s…
Browse files Browse the repository at this point in the history
…napshots
  • Loading branch information
andycall committed Mar 16, 2021
2 parents bc11633 + 84d4a12 commit 3a87c92
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
"mkdirp": "^0.5.1",
"rimraf": "^3.0.2",
"uuid": "^8.3.2",
"ws": "^7.3.0"
},
"dependencies": {
"ws": "^7.3.0",
"archiver": "^5.3.0"
}
}
47 changes: 34 additions & 13 deletions scripts/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { src, dest, series, parallel, task } = require('gulp');
const mkdirp = require('mkdirp');
const path = require('path');
const { readFileSync, writeFileSync, mkdirSync } = require('fs');
const { spawnSync, execSync, fork } = require('child_process');
const { spawnSync, execSync, fork, spawn } = require('child_process');
const { join, resolve } = require('path');
const chalk = require('chalk');
const fs = require('fs');
Expand Down Expand Up @@ -183,24 +183,45 @@ function matchError(errmsg) {
}

task('integration-test', (done) => {
const { status, stdout, stderr } = spawnSync('npm', ['run', 'test'], {
const childProcess = spawn('npm', ['run', 'test'], {
stdio: 'pipe',
cwd: paths.tests
});

let dartErrorMatch = matchError(stdout + stderr);
if (dartErrorMatch) {
let error = new Error('UnExpected Flutter Assert Failed.');
let stdout = '';

childProcess.stderr.pipe(process.stderr);
childProcess.stdout.pipe(process.stdout);

childProcess.stderr.on('data', (data) => {
stdout += data + '';
});

childProcess.stdout.pipe(process.stdout);
childProcess.stdout.on('data', (data) => {
stdout += data + '';
});

childProcess.on('error', (error) => {
done(error);
return;
}
});

if (status !== 0) {
console.error('Run intefration test with error.');
process.exit(status);
} else {
done();
}
childProcess.on('close', (code) => {
let dartErrorMatch = matchError(stdout);
if (dartErrorMatch) {
let error = new Error('UnExpected Flutter Assert Failed.');
done(error);
return;
}

if (code == 0) {
done();
} else {
// TODO: collect error message from stdout.
const err = new Error('Some error occured, please check log.');
done(err);
}
});
});

task('sdk-clean', (done) => {
Expand Down

0 comments on commit 3a87c92

Please sign in to comment.