Skip to content

Commit 2b0a1c8

Browse files
committed
fix: test failed pass
1 parent 1d2a520 commit 2b0a1c8

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

bin/rc-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ require("../lib")
1919
})
2020
.catch((e) => {
2121
console.error(e);
22+
2223
process.exit(1);
2324
});

src/index.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,25 @@ export default function (originOpts: any = {}) {
6767
}
6868
});
6969

70-
return runCLI(
71-
{
72-
config: JSON.stringify(config),
73-
...opts,
74-
},
75-
[cwd],
76-
);
70+
return new Promise((resolve, reject) => {
71+
runCLI(
72+
{
73+
config: JSON.stringify(config),
74+
...opts,
75+
},
76+
[cwd],
77+
)
78+
.then((result) => {
79+
const results = result.results;
80+
81+
if (results.success) {
82+
resolve(results);
83+
} else {
84+
reject(new Error('Jest failed'));
85+
}
86+
})
87+
.catch((e) => {
88+
console.log(e);
89+
});
90+
});
7791
}

0 commit comments

Comments
 (0)