1/* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16const assert = require('chai').assert; 17const fn = require('./compile'); 18const argv = require('yargs').argv; 19const argvSelect = { 20 key1: {}, 21 key2: { buildMode: 'release' }, 22 key3: { buildMode: 'debug' }, 23 key4: { buildMode: 'develope' }, 24}; 25const compileResult = { 26 key1: true, 27 key2: false, 28 key3: true, 29 key4: true, 30}; 31/** 32 * Test whether the existence of the sourcemap file is reasonable when different 'buildMode' is passed in. 33 * Only when the 'buildMode' is 'release', the sourcemap does not exist, otherwise it exists 34 */ 35describe('Compilation result test', () => { 36 it('sourcemap', (done) => { 37 const key = argv.buildMode ? argv.buildMode : 'key1'; 38 fn(argvSelect[key]) 39 .then((flag) => { 40 assert.equal(flag, compileResult[key], 'result pass'); 41 done(); 42 }) 43 .catch(done); 44 }); 45}); 46