test: hack in output directory cleanup for parallel runs (#2378)
This commit is contained in:
parent
4413138cc6
commit
0753c2d54b
|
|
@ -70,11 +70,18 @@ serverEnvironment.afterEach(async(state) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const customEnvironment = new Environment('Golden+CheckContexts');
|
const customEnvironment = new Environment('Golden+CheckContexts');
|
||||||
|
|
||||||
|
// simulate globalSetup per browserType that happens only once regardless of TestWorker.
|
||||||
|
const hasBeenCleaned = new Set();
|
||||||
|
|
||||||
customEnvironment.beforeAll(async state => {
|
customEnvironment.beforeAll(async state => {
|
||||||
const { OUTPUT_DIR, GOLDEN_DIR } = require('./utils').testOptions(state.browserType);
|
const { OUTPUT_DIR, GOLDEN_DIR } = require('./utils').testOptions(state.browserType);
|
||||||
if (fs.existsSync(OUTPUT_DIR))
|
if (!hasBeenCleaned.has(state.browserType)) {
|
||||||
rm(OUTPUT_DIR);
|
hasBeenCleaned.add(state.browserType);
|
||||||
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
if (fs.existsSync(OUTPUT_DIR))
|
||||||
|
rm(OUTPUT_DIR);
|
||||||
|
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
||||||
|
}
|
||||||
state.golden = goldenName => ({ goldenPath: GOLDEN_DIR, outputPath: OUTPUT_DIR, goldenName });
|
state.golden = goldenName => ({ goldenPath: GOLDEN_DIR, outputPath: OUTPUT_DIR, goldenName });
|
||||||
});
|
});
|
||||||
customEnvironment.afterAll(async state => {
|
customEnvironment.afterAll(async state => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue