mirror of
https://gitee.com/openharmony/developtools_ace_ets2bundle
synced 2024-11-23 08:29:55 +00:00
Fix the bug of deleting mock-config.json
Issue: #IB0XH5 Signed-off-by: wuhailong <wuhailong22@huawei.com> Change-Id: I366895181423d144b8be60255de63b878417639d
This commit is contained in:
parent
57823f4df5
commit
0b277393a5
@ -278,11 +278,11 @@ export class ModuleSourceFile {
|
||||
const userDefinedMockConfigCache: string =
|
||||
path.resolve(rollupObject.share.projectConfig.cachePath, `./${USER_DEFINE_MOCK_CONFIG}`);
|
||||
if (fs.existsSync(transformedMockConfigCache)) {
|
||||
fs.rm(transformedMockConfigCache);
|
||||
fs.rmSync(transformedMockConfigCache);
|
||||
}
|
||||
|
||||
if (fs.existsSync(userDefinedMockConfigCache)) {
|
||||
fs.rm(userDefinedMockConfigCache);
|
||||
fs.rmSync(userDefinedMockConfigCache);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,10 @@ import projectConfig from '../utils/processProjectConfig';
|
||||
import { ModuleInfo as ModuleInfoMock } from '../mock/rollup_mock/module_info';
|
||||
import { scanFiles } from "../utils/utils";
|
||||
import { SourceMapGenerator } from '../../../lib/fast_build/ark_compiler/generate_sourcemap';
|
||||
import {
|
||||
TRANSFORMED_MOCK_CONFIG,
|
||||
USER_DEFINE_MOCK_CONFIG
|
||||
} from '../../../lib/pre_define';
|
||||
|
||||
const ROLLUP_IMPORT_NODE: string = 'ImportDeclaration';
|
||||
const ROLLUP_EXPORTNAME_NODE: string = 'ExportNamedDeclaration';
|
||||
@ -814,4 +818,15 @@ mocha.describe('test module_source_file file api', function () {
|
||||
fs.unlinkSync(this.rollup.share.projectConfig.cachePath + '/mock-config.json5');
|
||||
});
|
||||
|
||||
mocha.it('6-1: test removePotentialMockConfigCache delete mock-config', function () {
|
||||
const transformedMockConfigCache: string =
|
||||
path.resolve(this.rollup.share.projectConfig.cachePath, `./${TRANSFORMED_MOCK_CONFIG}`);
|
||||
const userDefinedMockConfigCache: string =
|
||||
path.resolve(this.rollup.share.projectConfig.cachePath, `./${USER_DEFINE_MOCK_CONFIG}`);
|
||||
fs.writeFileSync(transformedMockConfigCache, '{}');
|
||||
fs.writeFileSync(userDefinedMockConfigCache, '{}');
|
||||
ModuleSourceFile.removePotentialMockConfigCache(this.rollup);
|
||||
expect(!fs.existsSync(transformedMockConfigCache)).to.be.true;
|
||||
expect(!fs.existsSync(userDefinedMockConfigCache)).to.be.true;
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user