Promise.all を使った並列化が可能であると考えられます。
コード:
const frisby = require('frisby');
describe('test', () => {
beforeEach((done) => {
console.log('★★★★★before_proceed');
Promise.all([
// 動作A
Promise.resolve()
.then(() => console.log("A start"))
.then(() => frisby.get('https://www.google.com').expect('status', 200))
.then(() => console.log("A end")),
// 動作B 失敗するように書きます
Promise.resolve()
.then(() => console.log("B start"))
.then(() => frisby.get('https://www.google.com').expect('status', 400))
.then(() => console.log("B end"))
]).then(done).catch(done);
});
it('試験実施:', (done) => {
// 動作C
expect(1).toBe(1);
done();
});
});
出力:
Randomized with seed 83497
Started
★★★★★before_proceed
A start
B start
A end
F
Failures:
1) test 試験実施:
Message:
Failed: HTTP status 400 !== 200
Stack:
error properties: Object({ generatedMessage: false, code: 'ERR_ASSERTION', actual: 200, expected: 400, operator: '===' })
at <Jasmine>
at FrisbySpec.status (/Users/set0gut1/tmp/g/node_modules/frisby/src/frisby/expects.js:25:12)
at response (/Users/set0gut1/tmp/g/node_modules/frisby/src/frisby/spec.js:373:23)
at _fetch._fetch.then.response (/Users/set0gut1/tmp/g/node_modules/frisby/src/frisby/spec.js:214:34)
at <Jasmine>
at process._tickCallback (internal/process/next_tick.js:188:7)
1 spec, 1 failure
Finished in 0.197 seconds
Randomized with seed 83497 (jasmine --random=true --seed=83497)