javascript - importing functions - NodeJS - non-html -


i learning automation work , little stuck. far stackoverflow has been life saver :)

i writing test selenium in visualstudio in javascript (nodes). understand not great combination thats work wants.

i have test in app.js file (see screenshot). references function in functions.js file. cannot recognise function though. presume need reference files containing function. have tried import 'import cellfromxls "functions.js";' , not work(unexpected token import error).

any ideas on can do? fancy modifying package.json file include files functions in them? on latest node.js , latest drivers.

also seems intellisense not work javascript in visual studio. right or anyway fix it? visualstudio screenshot

node doesn't support import natively yet.

in functions file can like

function blah(){     console.log("i blah") }  function wah(){     console.log("wah wah") }  module.exports = {     blah,     wah } 

then in app.js can do:

const functions = require('./functions.js') functions.blah() functions.wah() 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -