How to use resolvePath method in Testcafe

Best JavaScript code snippet using testcafe

api.js

Source:api.js Github

copy

Full Screen

...8/* eslint-enable */9export const pathname = '/api/wx'10const resolvePath = api => `${host + pathname}/${api}`11// common12export const API_PRELOAD = resolvePath('preload')13export const API_QRCODE = resolvePath('qrcode')14export const API_BANNER_LIST = resolvePath('extendContent')15export const API_QUERY_CODE_SCENE = resolvePath('qrcode/scene')16// user17export const API_USER_LOGIN = resolvePath('login')18export const API_USER_INFO = resolvePath('signup')19export const API_USER_SIGNIN = resolvePath('user/signin')20export const API_USER_PHONE = resolvePath('userPhone')21export const API_QUERY_USER_INFO = resolvePath('user/info')22export const API_QUERY_USERINFO_BYID = resolvePath('onePerson')23export const API_QUERY_CUSTOMER_INFO = resolvePath('customer/myCustomer')24export const API_QUERY_MYREPORT = resolvePath('customer/myReport')25export const API_QUERY_DOCUMENTVERIFY = resolvePath('documentVerify')26export const API_QUERY_DOCUMENTVERIFY_list = resolvePath('documentVerify/list')27export const API_QUERY_TADRAINGE = resolvePath('taDrainage')28// chat29export const API_CHAT_HISTORY = resolvePath('chat/history')30export const API_CHAT_SEND = wss_host + '/wx/chat'31export const API_CHAT_FRIENDS = resolvePath('chat/with')32export const API_UPLOAD_IMAGE = resolvePath('image')33export const API_CHAT_READED = resolvePath('chat/message')34// card35export const API_CARDS_LIST = resolvePath('cards')36export const API_CARDS_APPLY = resolvePath('cards/apply')37export const API_FORM_ID = resolvePath('formid')38export const API_UPDATE_PHOTO = resolvePath('userInfo/updatePhoto')39// project40export const API_INDEX_CUSTOMER = resolvePath('indexCustomer')41export const API_ITEMS_LIST = resolvePath('building/list')42export const API_ITEMS_DETAIL = resolvePath('buildingSelectId')43export const API_ITEMS_TYPE = resolvePath('tdBuildingType')44export const API_ACTIVITY_GROUP = resolvePath('helpActivityAndGroup')45export const API_LOCATION_CITYP = resolvePath('location/city')46export const API_TACUSTOMIMG = resolvePath('taCustomImg')47export const API_INDEX_PROJECTS = resolvePath('building/main')48export const API_INDEX_ICONS = resolvePath('taMiniappOrgIcon')49export const API_HOUSE_LIST = resolvePath('listHousingResources')50export const API_PRESELECTION_RECORD = resolvePath('listPreselectionRecord')51export const API_RAISE_CHECK = resolvePath('check/raise')52export const API_RAISE_PROFILE = resolvePath('taRaise')53export const API_SAVE_RAISE_RECORD = resolvePath('taRaiseRecord')54export const API_RATSE_RECORD = resolvePath('taRaiseRecord/list')55export const API_RATSE_DETAIL = resolvePath('taRaiseRecord')56export const API_RATSE_ORDER = resolvePath('unifiedOrder')57export const API_CANCEL_ORDER = resolvePath('cancel')58export const API_HOUSE_DETAIL = resolvePath('getHousingDetailById')59export const API_ADD_PRESELECTION = resolvePath('taPreselectionRecord')60export const API_CANCEL_PRESELECTION = resolvePath('taPreselectionRecordCancel')61export const API_APARTMENT_TYPE = resolvePath('listBuildApartmentBySalesBatchId')62export const API_SALESBATCH_LIST = resolvePath('taSalesBatch/choice')63export const API_NOTICE_INFO = resolvePath('getNoticeInfo')64export const API_SALES_BATCH = resolvePath('taSalesBatch')65export const API_ADDLIVE_NUM = resolvePath('addVisitNum')66export const API_LIVE_DEATIL = resolvePath('taLiveActivity')67// /wx/location/city?location=lon,lat68//sign69export const API_CONTRACT_USER = resolvePath('contract/user/add')70export const API_CONTRACT_GET = resolvePath('contract/user/get')71export const API_CONTRACT_AUTO = resolvePath('contract/auto')72export const API_CONTRACT_MANUAL = resolvePath('contract/manual')73export const API_CONTRACT_CHECK = resolvePath('contract/check')74// shop75export const API_GOODS_LIST = resolvePath('goods')76export const API_GOODS_BUILDING = resolvePath('goodsToBuilding')77export const API_GOODS_EXCHANGE = resolvePath('goods/exchange')78export const API_GOODS_EXCHANGE_RECORDS = resolvePath('taPointsExchange')79export const API_POINTS_RECORDS = resolvePath('taPointsRecords')80export const API_POINTS_RULE = resolvePath('tdPointsRules')81export const API_POINTS_ADRESS = resolvePath('person/city')82export const API_GOODS_BELONGS = resolvePath('goodsToBuilding')83// client84export const API_CLIENT_LIST = resolvePath('customer/recommend/mine')85export const API_RECOMENT_CLIENT = resolvePath('customer/new')86export const API_CLIENT_PROGRESS = resolvePath('customer')87export const API_TYPE_DATA = resolvePath('awesome/dict/recommendcustomer')88// report89export const API_REPORT_LIST = resolvePath('myReport')90export const API_REPORT_CLIENT = resolvePath('customer/report')91export const API_RECOMMEND_GET = resolvePath('customer/recommend/get')92export const API_RECOMMEND_EDIT = resolvePath('customer/recommend/edit')93// common94export const API_ITEMS_UV = resolvePath('project/hot')95export const API_CARDS_UV = resolvePath('consultant/hot')96export const API_ACTIVITY_UV = resolvePath('activity/pvNum')97export const API_NEWS_UV = resolvePath('taNews/pvNum')98export const API_CARDS_LIKE = resolvePath('consultant/like')99export const API_ITEMS_LIKE = resolvePath('project/like')100export const API_ACTIVITY_LIKE = resolvePath('activity/like')101export const API_NEWS_LIKE = resolvePath('news/like')102export const API_CARDS_SHARE = resolvePath('consultant/share')103export const API_ITEMS_SHARE = resolvePath('project/share')104export const API_ACTIVITY_SHARE = resolvePath('activity/share')105export const API_HELP_SHARE = resolvePath('help/share')106export const API_GROUP_SHARE = resolvePath('group/share')107export const API_HFIVE_SHARE = resolvePath('h5/share')108export const API_NEWS_SHARE = resolvePath('news/share')109export const API_HOUSE_SHARE = resolvePath('houseApp/share')110export const API_HOUSE_POSTER = resolvePath('housePost/share')111export const API_LIVE_SHARE = resolvePath('liveApp/share')112export const API_LIVE_POSTER = resolvePath('livePost/share')113export const API_INDEX_SHARE = resolvePath('main/share')114export const API_ACTIVITY_FAVOR = resolvePath('activity/save')115export const API_NEWS_FAVOR = resolvePath('news/save')116export const API_CARD_FAVOR = resolvePath('card/save')117export const API_PROJECT_FAVOR = resolvePath('project/save')118// 埋点接口119export const API_BURIED_POINT = resolvePath('taPersonVisitRecord')120// activity121export const API_ACTIVITY_LIST = resolvePath('buildingDynamiceList')122//拼团123export const API_GROUP_LIST = resolvePath('taShareRecord')124//助力125export const API_HELP_LIST = resolvePath('helpInitiateRecord')126// save activity127export const API_ACTIVITY_SAVE = resolvePath('save/buildingDynamiceList')128export const API_ACTIVITY_DETAIL = resolvePath('buildingDynamiceInfo')129// signup130export const API_ACTIVITY_SIGNUP = resolvePath('activityDynamicEnlistAdd')131// signin132export const API_ACTIVITY_SIGNIN = resolvePath('taCheckin/activity')133// news134export const API_NEWS_LIST = resolvePath('taNews')135// feedback136export const API_FEEDBACK_SUBMIT = resolvePath('taCustomerMessage')137// getCode138export const API_GET_CODE = resolvePath('captcha')139// checkCode140export const API_CHECK_CODE = resolvePath('check/captcha')141// /wx/registerConsultantOneClick142// registerConsultant143export const API_PUT_REGISTER = resolvePath('registerConsultant')144// registerConsultantOneClick145export const API_PUT_REGISTERCONSULTANT = resolvePath('registerConsultantOneClick')146// city147export const API_CITY_LIST = resolvePath('tdCity')148// policy149export const API_POLICY_LIST = resolvePath('taPolicy')150//agent151export const API_AGENT_LIST = resolvePath('agent/recommend/mine')152export const API_REGISTER_AGENT = resolvePath('registerAgent')153// agent change154export const API_AGENT_CHANNEL = resolvePath('customer/recommend/becomeChannel')155export const API_AGENT_CURRENT = resolvePath('user/current')156export const API_EDIT_AGENT = resolvePath('editPerson')157// 活动列表-新158export const API_ACTNEW_LIST = resolvePath('activity/list')159// 助力160export const API_HELP_DETAIL = resolvePath('helpActivity')161export const API_HELP_CREATE = resolvePath('helpInitiateRecord')162export const API_HELP_FRIEND = resolvePath('helpRecord')163//签到164export const API_CHECKIN_DETAILS = resolvePath('buildingDynamiceEnlistInfo')165export const API_CHECKIN_ACTIVE = resolvePath('buildingDynamicCheckin')166// 拼团167export const API_GROUP_DETAIL = resolvePath('taShareActivity')168export const API_GROUP_CREATE = resolvePath('taShareRecord')169export const API_GROUP_JOIN = resolvePath('taShareChildRecord')170//person171export const API_MY_CUSTOMER = resolvePath('inventory/customer/statistics')172export const API_CUSTOMER_LIST = resolvePath('inventory/customer/statistics')173export const API_CUSTOMER_DETAIL = resolvePath('inventory/customer')174export const API_VISIT_RECORD = resolvePath('taPersonVisitRecord')175export const API_ACTIVITY_LIST_CUSTOMER = resolvePath('customer/activity/list')176export const API_FOLLOW_LIST = resolvePath('taCustomerFollowUpRecord')177export const API_SEX_INFO = resolvePath('genderStatistic')178export const API_ECHERTS_DAILY = resolvePath('customerStatisticDaily')179export const API_ECHERTS_MONTH = resolvePath('customerStatisticMonthly')180export const API_BUILDING_TYPE = resolvePath('getByBuildingIdSelectBuildingProjectType')181export const API_CONSULTANT_VISIT_RECORD = resolvePath('activityVisitRecord')182export const API_MORE_ACTIVITY = resolvePath('visitRecord/activity')183export const API_SHARE_LIST = resolvePath('shareRecords')184export const API_SHARE_INFOLIST = resolvePath('sharePersonInfoList')185export const API_BIND_CUSTOMER = resolvePath('judgeBindCustomer')186// 消息模板...

Full Screen

Full Screen

gulpfile.js

Source:gulpfile.js Github

copy

Full Screen

...25const RELEASE_DEBUG_PATH = 'dist/debug';26const RELEASE_PUBLIC_PATH = 'dist';27const SOURCE_ROOT_PATH = 'src';28const isSourceMap = false;29function resolvePath(p) {30 return path.resolve(__dirname, '../', p);31}32if (!fs.existsSync(resolvePath(RELEASE_ROOT_PATH))) {33 fs.mkdirSync(resolvePath(RELEASE_ROOT_PATH));34}35if (!fs.existsSync(resolvePath(RELEASE_DEBUG_PATH))) {36 fs.mkdirSync(resolvePath(RELEASE_DEBUG_PATH));37}38function buildByRollUp(input, output, name) {39 return walkByRollup([{40 input,41 plugins: [42 eslint({43 exclude: 'node_modules/**',44 }),45 babel({46 exclude: 'node_modules/**',47 // rollup使用"transform-runtime"只能通过配置48 // 可以将所有的垫片函数集成到一起,避免重复冗余49 runtimeHelpers: true,50 // 使用class时,external-helpers会莫名其妙引入asyncGenerator51 // 而runtime不会52 // plugins: ['external-helpers'],53 }),54 ],55 output: {56 file: output,57 },58 format: 'umd',59 name,60 banner,61 sourcemap: isSourceMap,62 }]);63}64gulp.task('build_main', () => buildByRollUp(65 resolvePath(`${SOURCE_ROOT_PATH}/index.js`),66 resolvePath(`${RELEASE_DEBUG_PATH}/minirefresh.js`),67 'MiniRefreshTools'));68gulp.task('build_themes', () => {69 const basePath = resolvePath(`${SOURCE_ROOT_PATH}/themes/`);70 const pa = fs.readdirSync(basePath);71 72 if (!fs.existsSync(resolvePath(`${RELEASE_DEBUG_PATH}/themes/`))) {73 fs.mkdirSync(resolvePath(`${RELEASE_DEBUG_PATH}/themes/`));74 }75 76 pa.forEach((ele) => {77 const info = fs.statSync(path.resolve(basePath, ele));78 79 if (info.isDirectory()) {80 // console.log(`dir:${ele}`);81 if (!fs.existsSync(resolvePath(`${RELEASE_DEBUG_PATH}/themes/${ele}`))) {82 fs.mkdirSync(resolvePath(`${RELEASE_DEBUG_PATH}/themes/${ele}`));83 }84 buildByRollUp(85 resolvePath(`${SOURCE_ROOT_PATH}/themes/${ele}/${ele}.js`),86 resolvePath(`${RELEASE_DEBUG_PATH}/themes/${ele}/minirefresh.theme.${ele}.js`),87 'MiniRefresh');88 // css89 gulp.src([90 resolvePath(`${SOURCE_ROOT_PATH}/themes/${ele}/${ele}.styl`),91 ])92 .pipe(gulpStylus())93 .pipe(gulpConcat(`minirefresh.theme.${ele}.css`))94 .pipe(gulp.dest(resolvePath(`${RELEASE_DEBUG_PATH}/themes/${ele}/`)));95 96 // 资源97 gulp.src([98 resolvePath(`${SOURCE_ROOT_PATH}/themes/${ele}/images/*`),99 ])100 .pipe(gulp.dest(resolvePath(`${RELEASE_DEBUG_PATH}/themes/${ele}/images/`)));101 }102 });103});104// eslint代码检查打包文件以外的文件105gulp.task('eslint_others', () => gulp.src([106 resolvePath('build/**/*.js'),107 resolvePath('test/**/*.js'),108 // 主动ignore109 `!${resolvePath('test/inner/promise.js')}`,110])111 .pipe(gulpEslint())112 .pipe(gulpEslint.format()));113// 开启后如果报错会退出114// .pipe(gulpEslint.failAfterError());115gulp.task('concat_css', () => gulp.src([116 resolvePath(`${SOURCE_ROOT_PATH}/styl/index.styl`),117])118 .pipe(gulpStylus())119 .pipe(gulpConcat('minirefresh.css'))120 .pipe(gulp.dest(resolvePath(RELEASE_DEBUG_PATH))));121// 打包 核心文件的资源css和资源的打包122gulp.task('pack_resources', () => gulp.src([123 resolvePath(`${SOURCE_ROOT_PATH}/styl/**/*`),124 '!PATH'.replace('PATH', resolvePath(`${SOURCE_ROOT_PATH}/**/*.styl`)),125 126])127 .pipe(gulp.dest(resolvePath(RELEASE_DEBUG_PATH))));128gulp.task('build', ['build_main', 'concat_css', 'pack_resources', 'build_themes', 'eslint_others']);129gulp.task('dist_js_uglify', () => gulp.src([130 resolvePath(`${RELEASE_DEBUG_PATH}/**/*.js`),131 '!PATH'.replace('PATH', resolvePath(`${RELEASE_DEBUG_PATH}/**/*.min.js`)),132])133 .pipe(gulpUglify())134 .on('error', (err) => {135 console.log('line number: %d, message: %s', err.lineNumber, err.message);136 this.end();137 })138 .pipe(gulpRename({139 suffix: '.min',140 }))141 .pipe(gulpHeader(banner))142 .pipe(gulp.dest(resolvePath(`${RELEASE_PUBLIC_PATH}/`))));143// 压缩core css144gulp.task('clean_css', () => gulp.src([145 resolvePath(`${RELEASE_DEBUG_PATH}/**/*.css`),146 '!PATH'.replace('PATH', resolvePath(`${RELEASE_DEBUG_PATH}/**/*.min.css`)),147])148 .pipe(gulpCleanCSS())149 .pipe(gulpRename({150 suffix: '.min',151 }))152 .pipe(gulp.dest(resolvePath(`${RELEASE_PUBLIC_PATH}/`))));153 154gulp.task('pack_resources_release', () => gulp.src([155 resolvePath(`${RELEASE_DEBUG_PATH}/**/*`),156 '!PATH'.replace('PATH', resolvePath(`${RELEASE_DEBUG_PATH}/**/*.css`)),157 '!PATH'.replace('PATH', resolvePath(`${RELEASE_DEBUG_PATH}/**/*.js`)),158])159 .pipe(gulp.dest(resolvePath(`${RELEASE_PUBLIC_PATH}/`))));160gulp.task('dist', [161 'pack_resources_release',162 'dist_js_uglify',163 'clean_css',164]);165gulp.task('concat_minirefresh_theme_js', () => gulp.src([166 resolvePath(`${RELEASE_DEBUG_PATH}/minirefresh.js`),167 resolvePath(`${RELEASE_DEBUG_PATH}/themes/default/minirefresh.theme.default.js`),168])169 .pipe(gulpConcat('minirefresh.js'))170 .pipe(gulp.dest(resolvePath(RELEASE_DEBUG_PATH))));171 172gulp.task('concat_minirefresh_theme_css', () => gulp.src([173 resolvePath(`${RELEASE_DEBUG_PATH}/minirefresh.css`),174 resolvePath(`${RELEASE_DEBUG_PATH}/themes/default/minirefresh.theme.default.css`),175])176 .pipe(gulpConcat('minirefresh.css'))177 .pipe(gulp.dest(resolvePath(RELEASE_DEBUG_PATH))));178/*179 * 合并主题方式暂时放弃,改为代码内部自动选择引入对应主题180 */181gulp.task('concat_theme', [182 'concat_minirefresh_theme_js',183 'concat_minirefresh_theme_css',184]);185gulp.task('default', (callback) => {186 gulpSequence('build', 'dist')(callback);187});188gulp.task('watch', () => {189 gulp.watch([190 resolvePath(`${SOURCE_ROOT_PATH}/**/**/*.js`),191 resolvePath(`${SOURCE_ROOT_PATH}/**/**/*.styl`),192 resolvePath('build/**/*.js'),193 resolvePath('test/**/*.js'),194 ], ['default']);...

Full Screen

Full Screen

util.js

Source:util.js Github

copy

Full Screen

...9var assert = require('assert');10var util = require('../lib/util.js').default;11describe('util.js', () => {12 it('$resolvePath', () => {13 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', 'page2'), '/page/abc/efg/hij/page2', `resolvePath('/page/abc/efg/hij/klm', 'page2')`);14 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '.'), '/page/abc/efg/hij/klm', `resolvePath('/page/abc/efg/hij/klm', '.')`);15 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '..'), '/page/abc/efg/hij/klm', `resolvePath('/page/abc/efg/hij/klm', '..')`);16 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', 'a'), '/page/abc/efg/hij/a', `resolvePath('/page/abc/efg/hij/klm', 'a')`);17 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '.page2'), '/page/abc/efg/hij/page2', `resolvePath('/page/abc/efg/hij/klm', '.page2')`);18 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '.a'), '/page/abc/efg/hij/a', `resolvePath('/page/abc/efg/hij/klm', '.a')`);19 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '..page2'), '/page/abc/efg/hij/page2', `resolvePath('/page/abc/efg/hij/klm', '..page2')`);20 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '..aa'), '/page/abc/efg/hij/aa', `resolvePath('/page/abc/efg/hij/klm', '..aa')`);21 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', './page2'), '/page/abc/efg/hij/page2', `resolvePath('/page/abc/efg/hij/klm', './page2')`);22 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '../page2'), '/page/abc/efg/page2', `resolvePath('/page/abc/efg/hij/klm', '../page2')`);23 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '.../page2'), '/page/abc/efg/page2', `resolvePath('/page/abc/efg/hij/klm', '.../page2')`);24 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '..../page2'), '/page/abc/efg/page2', `resolvePath('/page/abc/efg/hij/klm', '..../page2')`);25 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', './../page2'), '/page/abc/efg/page2', `resolvePath('/page/abc/efg/hij/klm', './../page2')`);26 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', './../../page2'), '/page/abc/page2', `resolvePath('/page/abc/efg/hij/klm', './../../page2')`);27 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', './../.../page2'), '/page/abc/page2', `resolvePath('/page/abc/efg/hij/klm', './../.../page2')`);28 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', './../../../page2'), '/page/page2', `resolvePath('/page/abc/efg/hij/klm', './../../../page2')`);29 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', './../../../../page2'), '/page2', `resolvePath('/page/abc/efg/hij/klm', './../../../../page2')`);30 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', './../../../../../page2'), '/page2', `resolvePath('/page/abc/efg/hij/klm', './../../../../page2')`);31 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '/page2'), '/page2', `resolvePath('/page/abc/efg/hij/klm', '/page2')`);32 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '//page2'), '/page2', `resolvePath('/page/abc/efg/hij/klm', '//page2')`);33 assert.strictEqual(util.$resolvePath('/page/abc/efg/hij/klm', '/./page2'), '/page2', `resolvePath('/page/abc/efg/hij/klm', '/./page2')`);34 });35 it('$getParams', () => {36 let p;37 p = util.$getParams('index?a=1&b=2');38 assert.strictEqual(Object.keys(p).length, 2, `$getParams('index?a=1&b=2')`);39 assert.strictEqual(p.a, '1');40 assert.strictEqual(p.b, '2');41 p = util.$getParams('index?a=1&b=2&c=' + encodeURIComponent('中国'));42 assert.strictEqual(Object.keys(p).length, 3, `$getParams('index?a=1&b=2')`);43 assert.strictEqual(p.a, '1');44 assert.strictEqual(p.b, '2');45 assert.strictEqual(p.c, '中国');46 });47});

Full Screen

Full Screen

webpack.config.base.js

Source:webpack.config.base.js Github

copy

Full Screen

...7const MiniCssExtractPlugin = require("mini-css-extract-plugin");8let isDev = global._ENV == 'development';9module.exports = {10 entry: {11 main: [ resolvePath('src/main.ts')]12 } ,13 output: {14 // 打包后的文件存放的路径15 path: isDev ? resolvePath('dist') : resolvePath('lib/dist'),16 publicPath: isDev? './': '/devTools/',17 // 打包后输出文件的文件名18 filename:isDev ? 'js/bundle.js' :'js/[name].[contenthash].js',19 chunkFilename: isDev ? 'js/[name].[hash].js' :'js/[name].[contenthash].js',20 },21 resolve: {22 extensions: ['.ts', '.js', '.vue', '.d.ts', '.json'],23 alias: {24 '@': resolvePath('src'),25 '@store$':resolvePath('src/store/index.js'),26 '@components':resolvePath('src/components'),27 '@pages':resolvePath('src/pages'),28 '@assets':resolvePath('src/assets')29 }30 },31 module: {32 rules: [33 {34 test: /\.vue$/,35 loader: 'vue-loader',36 include:[resolvePath('src')],37 exclude:/node_modules/,38 options: {39 presets: [['@babel/preset-env']], // https://www.babeljs.cn/docs/plugins/preset-env40 plugins: ['@babel/plugin-syntax-dynamic-import'],41 cacheDirectory: isDev ? resolvePath('cache/dev') : false42 }43 }, 44 {45 test: /\.js$/,46 loader: 'babel-loader',47 include:[48 resolvePath('src'),49 resolvePath('node_modules/element-plus')50 ],51 exclude:/node_modules\/(?!element\-plus)/,52 options: {53 cacheDirectory: isDev ? resolvePath('cache/dev') : false54 }55 },56 {57 test: /\.ts$/,58 loader: 'ts-loader',59 include:[60 resolvePath('src'),61 resolvePath('node_modules/element-plus')62 ],63 exclude:/node_modules\/(?!element\-plus)/,64 },65 {66 test: /\.(png|jpe?g|gif|svg|pdf)(\?.*)?$/,67 use: {68 loader: 'url-loader',69 options: {70 limit: 2000,71 name: 'img/[name].[hash:7].[ext]'72 }73 }74 }, {75 test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,76 use: {77 loader: 'url-loader',78 options: {79 limit: 10000,80 name: 'media/[name].[hash:7].[ext]'81 }82 }83 }, {84 test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,85 include:[86 resolvePath('src'),87 resolvePath('node_modules/element-plus')88 ],89 use: {90 loader: 'url-loader',91 options: {92 limit: 10000,93 name: 'fonts/[name].[hash:7].[ext]'94 }95 }96 },97 {98 test: /\.css$/,99 include:[100 resolvePath('src'),101 resolvePath('node_modules/element-plus')102 ],103 use: (function(){104 let loaders = ['css-loader'];105 if (!isDev) {106 loaders.unshift(MiniCssExtractPlugin.loader)107 } else {108 loaders.unshift('style-loader')109 }110 return loaders;111 })()112 },113 {114 test: /\.scss$/,115 use: [116 'style-loader',117 'css-loader',118 'sass-loader'119 ]120 }121 ]122 },123 plugins: [124 new HtmlWebpackPlugin({125 filename: 'index.html',126 template: resolvePath('src/index.html'),127 inject: true,128 title: 'super-mock',129 favicon: false130 }),131 new VueLoaderPlugin(),132 // new CopyWebpackPlugin({133 // patterns: [134 // {from: resolvePath('static'), to: 'dist/static'}135 // ]136 // })137 ]...

Full Screen

Full Screen

resolvePath.test.js

Source:resolvePath.test.js Github

copy

Full Screen

...11const resolvePath = require('../lib/utils/resolvePath')12describe('resolvePath', function() {13 it('should resolvePath spec', () => {14 expect(fixture('./resolvePath/spec/index.js')).toBe(15 resolvePath('./spec', {16 fs,17 basedir: fixture('./resolvePath')18 })19 )20 })21 it('should resolvePath extensions', () => {22 expect(fixture('./resolvePath/spec/index.jsx')).toBe(23 resolvePath('./spec', {24 fs,25 moduleFileExtensions: ['.jsx', '.js'],26 basedir: fixture('./resolvePath')27 })28 )29 })30 it('should resolvePath moduleDirectories', () => {31 expect(fixture('./resolvePath/modules/foo.js')).toBe(32 resolvePath('foo', {33 fs,34 moduleDirectories: ['modules'],35 basedir: fixture('./resolvePath')36 })37 )38 })39 it('should resolvePath moduleDirectories array', () => {40 expect(fixture('./resolvePath/high-modules/foo.js')).toBe(41 resolvePath('foo', {42 fs,43 moduleDirectories: ['high-modules', 'modules'],44 basedir: fixture('./resolvePath')45 })46 )47 expect(fixture('./resolvePath/modules/bar.js')).toBe(48 resolvePath('bar', {49 fs,50 moduleDirectories: ['high-modules', 'modules'],51 basedir: fixture('./resolvePath')52 })53 )54 })55 it('should resolvePath browser', () => {56 expect(fixture('./resolvePath/browser/main.js')).toBe(57 resolvePath('.', {58 fs,59 basedir: fixture('./resolvePath/browser')60 })61 )62 expect(fixture('./resolvePath/browser/browser.js')).toBe(63 resolvePath('./', {64 browser: true,65 fs,66 basedir: fixture('./resolvePath/browser')67 })68 )69 })70 it('should resolvePath - modulePaths', () => {71 expect(fixture('./resolvePath/paths/modules/foo.js')).toBe(72 resolvePath('foo', {73 fs,74 modulePaths: [fixture('./resolvePath/paths/modules')],75 basedir: fixture('./resolvePath/paths')76 })77 )78 })79 describe('memoryFs', function() {80 let memoryFs81 function writeFiles(files) {82 for (const [name, data] of Object.entries(files)) {83 memoryFs.mkdirpSync(dirname(name))84 memoryFs.writeFileSync(name, String(data))85 }86 }87 beforeEach(() => {88 memoryFs = new MemoryFs()89 })90 it('should resolvePath - normal', function() {91 writeFiles({92 '/index.js': ' '93 })94 expect('/index.js').toBe(95 resolvePath('./index.js', {96 basedir: '/',97 fs: memoryFs98 })99 )100 })101 it('should resolvePath - browser', function() {102 writeFiles({103 '/node_modules/foo/package.json': JSON.stringify({104 name: 'foo',105 browser: {106 './index.js': 'index.browser.js'107 }108 }),109 '/node_modules/foo/index.js': ' ',110 '/node_modules/foo/index.browser.js': ' '111 })112 expect('/node_modules/foo/index.browser.js').toBe(113 resolvePath('foo', {114 browser: true,115 basedir: '/',116 fs: memoryFs117 })118 )119 })120 })...

Full Screen

Full Screen

resolve-path.spec.js

Source:resolve-path.spec.js Github

copy

Full Screen

1const {resolvePath} = require('../../src/path.js')2describe('resolvePath()', () => {3 it('should support resolving against absolute paths', () => {4 expect(resolvePath('/', '')).toBe('/')5 expect(resolvePath('/', '.')).toBe('/')6 expect(resolvePath('/', '/')).toBe('/')7 expect(resolvePath('/', '/x/y')).toBe('/x/y')8 expect(resolvePath('/p/a/t/h', '')).toBe('/p/a/t/h')9 expect(resolvePath('/p/a/t/h', '/x/y')).toBe('/x/y')10 expect(resolvePath('/p/a/t/h', 'x')).toBe('/p/a/t/x')11 expect(resolvePath('/p/a/t/h/', 'x')).toBe('/p/a/t/h/x')12 expect(resolvePath('/p/a/t/h', 'x/')).toBe('/p/a/t/x/')13 expect(resolvePath('/p/a/t/h', 'x/y')).toBe('/p/a/t/x/y')14 expect(resolvePath('/p/a/t/h', 'x?y#z')).toBe('/p/a/t/x?y#z')15 expect(resolvePath('/p/a/t/h', '.')).toBe('/p/a/t/')16 expect(resolvePath('/p/a/t/h', './x')).toBe('/p/a/t/x')17 expect(resolvePath('/p/a/t/h', '..')).toBe('/p/a/')18 expect(resolvePath('/p/a/t/h', '../x')).toBe('/p/a/x')19 expect(resolvePath('/p/a/t/h', '../../..')).toBe('/')20 expect(resolvePath('/p/a/t/h', '../../../x')).toBe('/x')21 expect(resolvePath('/p/a/t/h', '../../../..')).toBe('/')22 expect(resolvePath('/p/a/t/h', '../../../../x')).toBe('/x')23 expect(resolvePath('/p/a/t/h', '../../../../..')).toBe('/')24 })25 it('should support resolving against relative paths', () => {26 expect(resolvePath('', '')).toBe('.')27 expect(resolvePath('', '.')).toBe('.')28 expect(resolvePath('', '/')).toBe('/')29 expect(resolvePath('', '/x/y')).toBe('/x/y')30 expect(resolvePath('p/a/t/h', '')).toBe('p/a/t/h')31 expect(resolvePath('p/a/t/h', '/x/y')).toBe('/x/y')32 expect(resolvePath('p/a/t/h', 'x')).toBe('p/a/t/x')33 expect(resolvePath('p/a/t/h/', 'x')).toBe('p/a/t/h/x')34 expect(resolvePath('p/a/t/h', 'x/')).toBe('p/a/t/x/')35 expect(resolvePath('p/a/t/h', 'x/y')).toBe('p/a/t/x/y')36 expect(resolvePath('p/a/t/h', 'x?y#z')).toBe('p/a/t/x?y#z')37 expect(resolvePath('p/a/t/h', '.')).toBe('p/a/t/')38 expect(resolvePath('p/a/t/h', './x')).toBe('p/a/t/x')39 expect(resolvePath('p/a/t/h', '..')).toBe('p/a/')40 expect(resolvePath('p/a/t/h', '../x')).toBe('p/a/x')41 expect(resolvePath('p/a/t/h', '../../..')).toBe('.')42 expect(resolvePath('p/a/t/h', '../../../x')).toBe('x')43 expect(resolvePath('p/a/t/h', '../../../..')).toBe('..')44 expect(resolvePath('p/a/t/h', '../../../../x')).toBe('../x')45 expect(resolvePath('p/a/t/h', '../../../../..')).toBe('../..')46 })...

Full Screen

Full Screen

untils.js

Source:untils.js Github

copy

Full Screen

1const path = require('path');2const resolvePath = (dir) => path.join(__dirname, '../', dir);3const paths = {4 root: resolvePath(''),5 src: resolvePath('src'),6 public: resolvePath('public/'),7 dist: resolvePath('dist/'),8 indexHTML: resolvePath('public/index.html'),9 indexJS: resolvePath('src/index.js'),10 assets: resolvePath('public/assets'),11 fonts: resolvePath('public/fonts'),12 image: resolvePath('public/images'),13 nodeModule: resolvePath('node_modules'),14};15const regex = {16 css: /\.css$/i,17 cssModule: /\.module\.css$/i,18 sass: /\.(scss|sass)$/i,19 sassModule: /\.module\.(scss|sass)$/i,20 avif: /\.avif$/i,21 image: /\.(png|jpe?g|gif|bmp|ico)$/i,22 svg: /\.svg$/i,23 font: /\.(woff|woff2|eot|ttf|otf)$/i,24 js: /\.(js|jsx)$/i,25 ts: /\.(ts|tsx)$/i,26};27const formatFileName = '[name].[hash:8].[ext]';28const postCSS = {29 loader: 'postcss-loader',30 options: {31 postcssOptions: {32 config: resolvePath('config/postcss.config.js'),33 },34 },35};36module.exports = {37 paths,38 regex,39 formatFileName,40 resolvePath,41 postCSS,...

Full Screen

Full Screen

paths.js

Source:paths.js Github

copy

Full Screen

2const fs = require('fs')3const appDirectory = fs.realpathSync(process.cwd())4const resolvePath = relativePath => path.resolve(appDirectory, relativePath)5module.exports = {6 build: resolvePath('build'),7 builtHtml: resolvePath('build/index.html'),8 postcssConfig: resolvePath('config/postcss.config.js'),9 devEnv: resolvePath('config/development.env'),10 prodEnv: resolvePath('config/production.env'),11 public: resolvePath('public'),12 html: resolvePath('public/index.html'),13 src: resolvePath('src'),14 api: resolvePath('src/api'),15 components: resolvePath('src/components'),16 firebase: resolvePath('src/firebase'),17 icons: resolvePath('src/icons'),18 redux: resolvePath('src/redux'),19 styledComponents: resolvePath('src/styled-components'),20 mainJs: resolvePath('src/main.js'),21 mainScss: resolvePath('src/styles/main.scss')...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { resolvePath } from 'testcafe';2test('My test', async t => {3 const filePath = resolvePath('fileToUpload.txt');4 await t.setFilesToUpload('input[type=file]', filePath);5});6import { ClientFunction } from 'testcafe';7test('My test', async t => {8 const getFilePath = ClientFunction(() => {9 return 'fileToUpload.txt';10 });11 const filePath = await getFilePath();12 await t.setFilesToUpload('input[type=file]', filePath);13});14t.setFilesToUpload( selector, filePath | files | fileList | filePayload | filePayloads | filePayloadList | inputSelector ) → this | Promise

Full Screen

Using AI Code Generation

copy

Full Screen

1import { resolvePath } from 'testcafe';2 .page(resolvePath('index.html'));3test('My Test', async t => {4});5import { resolvePath } from 'testcafe';6 .page(resolvePath('index.html'));7test('My Test', async t => {8});9import { resolvePath } from 'testcafe';10 .page(resolvePath('index.html'));11test('My Test', async t => {12});13import { resolvePath } from 'testcafe';14 .page(resolvePath('index.html'));15test('My Test', async t => {16});17import { resolvePath } from 'testcafe';18 .page(resolvePath('index.html'));19test('My Test', async t => {20});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { resolvePath } from 'testcafe';2 .page(resolvePath('test.html'));3test('My test', async t => {4});5resolvePath(relativePath)6import { resolvePath } from 'testcafe';7 .page(resolvePath('test.html'));8test('My test', async t => {9});10resolvePath(relativePath)11import { resolve

Full Screen

Using AI Code Generation

copy

Full Screen

1import { resolvePath } from 'testcafe';2 .page(resolvePath('index.html'));3test('My Test', async t => {4});5import { resolvePath } from 'testcafe';6 .page(resolvePath('index.html'));7test('My Test', async t => {8});9import { resolvePath } from 'testcafe';10 .page(resolvePath('./index.html'));11test('My Test', async t => {12});13import { resolvePath } from 'testcafe';14 .page(resolvePath('../index.html'));15test('My Test', async t => {16});17import { resolvePath } from 'testcafe';18 .page(resolvePath('../../index.html'));19test('My Test', async t => {20});21import { resolvePath } from 'testcafe';22 .page(resolvePath('../../../index.html'));23test('My Test', async t => {24});25import { resolvePath } from 'testcafe';26 .page(resolvePath('../../../../index.html'));27test('My Test', async t => {28});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { resolvePath } from 'testcafe';2const path = resolvePath('path/to/file');3await t.setFilesToUpload(input, path);4import { resolvePath } from 'testcafe';5const path = resolvePath('path/to/file');6await t.setFilesToUpload(input, path);7import { resolvePath } from 'testcafe';8const path = resolvePath('path/to/file');9await t.setFilesToUpload(input, path);10import { resolvePath } from 'testcafe';11const path = resolvePath('path/to/file');12await t.setFilesToUpload(input, path);13import { resolvePath } from 'testcafe';14const path = resolvePath('path/to/file');15await t.setFilesToUpload(input, path);16import { resolvePath } from 'testcafe';17const path = resolvePath('path/to/file');18await t.setFilesToUpload(input, path);19import { resolvePath } from 'testcafe';20const path = resolvePath('path/to/file');21await t.setFilesToUpload(input, path);22import { resolvePath } from 'testcafe';23const path = resolvePath('path/to/file');24await t.setFilesToUpload(input, path);25import { resolvePath } from 'testcafe';26const path = resolvePath('path/to/file');27await t.setFilesToUpload(input, path);28import { resolvePath } from 'testcafe';29const path = resolvePath('path/to/file');30await t.setFilesToUpload(input, path

Full Screen

Using AI Code Generation

copy

Full Screen

1import { resolvePath } from 'testcafe';2 .page(resolvePath('/index.html'));3test('My Test', async t => {4});5import { resolvePath } from 'testcafe';6 .page(resolvePath('./index.html'));7test('My Test', async t => {8});9import { resolvePath } from 'testcafe';10 .page(resolvePath('./index.html'));11test('My Test', async t => {12 const getFilePath = ClientFunction(() => {13 return resolvePath('./file.txt');14 });15});16import { resolvePath } from 'testcafe';17 .page(resolvePath('./index.html'));18test('My Test', async t => {19 const image = Selector(resolvePath('./image.png'));20});21import { resolvePath } from 'testcafe';22 .page(resolvePath('./index.html'));23test('My Test', async t => {24 await t.takeScreenshot(resolvePath('./screenshot.png'));25});26import { resolvePath } from 'testcafe';27 .page(resolvePath('./index.html'));28test('My Test', async t => {29 const image = Selector(resolvePath('./image.png'));30 await t.takeElementScreenshot(image, resolvePath('./image.png'));31});

Full Screen

Using AI Code Generation

copy

Full Screen

1var testControllerHolder = require('./testControllerHolder.js');2var tc = testControllerHolder.get();3var path = require('path');4var fs = require('fs');5var test = require('testcafe');6var resolvePath = test.resolvePath;7var path = resolvePath('test.js');8console.log(path);9var testController;10exports.get = function () {11 return testController;12};13exports.init = function (t) {14 testController = t;15};16import { Selector } from 'testcafe';17test('My first test', async t => {18 .typeText('#developer-name', 'John Smith')19 .click('#submit-button');20});21test('My second test', async t => {22 .typeText('#developer-name', 'John Smith')23 .click('#submit-button');24});25I have tried this but i am not getting the path of the current running file. It is giving me the path of testcafefile.js. I want the path of the file in which i am using resolvePath() method. How can i achieve this?26import { Selector } from 'testcafe';27test('My first test', async t => {28 .click(Selector('button').withText('Cerrar'))29 .click(Selector('button').withText('Aceptar'))30 .typeText(Selector('input').withAttribute('placeholder', '¿A dónde viajas?'), '

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Testcafe automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful