Ensure that errors in testing are handled correctly
This commit is contained in:
committed by
mrugesh
parent
8b1f5ddded
commit
c6cbaf3658
@ -83,6 +83,11 @@ let page;
|
|||||||
runTests();
|
runTests();
|
||||||
|
|
||||||
async function runTests() {
|
async function runTests() {
|
||||||
|
process.on('unhandledRejection', err => {
|
||||||
|
spinner.stop();
|
||||||
|
throw new Error(`unhandledRejection: ${err.name}, ${err.message}`);
|
||||||
|
});
|
||||||
|
|
||||||
let testLangs = [...supportedLangs];
|
let testLangs = [...supportedLangs];
|
||||||
if (process.env.TEST_CHALLENGES_FOR_LANGS) {
|
if (process.env.TEST_CHALLENGES_FOR_LANGS) {
|
||||||
const filterLangs = process.env.TEST_CHALLENGES_FOR_LANGS.split(',').map(
|
const filterLangs = process.env.TEST_CHALLENGES_FOR_LANGS.split(',').map(
|
||||||
|
@ -26,10 +26,11 @@ const processor = unified()
|
|||||||
// we need to write a compiler that can create graphql nodes
|
// we need to write a compiler that can create graphql nodes
|
||||||
.use(html);
|
.use(html);
|
||||||
|
|
||||||
exports.parseMarkdown = function parseMarkdown(file) {
|
exports.parseMarkdown = function parseMarkdown(filename) {
|
||||||
return new Promise((resolve, reject) =>
|
return new Promise((resolve, reject) =>
|
||||||
processor.process(vfile.readSync(file), function(err, file) {
|
processor.process(vfile.readSync(filename), function(err, file) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
err.message += ' in file ' + filename;
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
delete file.contents;
|
delete file.contents;
|
||||||
|
Reference in New Issue
Block a user