Exploring test suite pathways while utilizing ArcGIS JSAPI as an alternative loader within the Intern framework

I have been developing an application using the ArcGIS Javascript API and incorporating tests with Intern. While working on Windows 7 under IIS, I encountered some challenges but managed to overcome them by following the Intern tutorial and referring to solutions like altering loaders for Intern. By setting the loader in client.html to

<script src="http://js.arcgis.com/3.7/"></script>
, I was able to run my tests successfully after adjusting paths in both the query string and intern.js to include the parent path defined in IIS.

For instance, assuming my app is hosted at http://localhost/testApp/mySite with folders such as js, css, tests, and node_modules within it, running tests would require altering the path to something like

http://localhost/testApps/mySite/node_modules/intern/client.html?config=mySite/tests/intern
by adding mySite to the config location. Similarly, suites had to be defined accordingly in my configuration:

suites: [
    'mySite/tests/suite1',
    'mySite/tests/suite2',
    'mySite/tests/suite3'
],

If sticking to the default loader script tag without changing to a different loader in client.html, which uses the version of Dojo from node_modules, no additional path modification is needed (although the esri library might not be found).

In addition, I came across the esri jsapi version of the Intern tutorial, where loader changes were not required. The difference lies in utilizing intern-geezer instead of the regular Intern due to compatibility issues with Dojo 1.8.3. However, since I am using esri jsapi 3.7 with Dojo 1.9.1 and do not need support for older IE versions, I prefer avoiding geezer if possible. Despite specifying packages in intern.js similarly to the tutorial, one test did not pass, probably due to chai discrepancies between regular Intern and geezer. Nonetheless, utilizing intern-geezer did not necessitate any path modifications, unlike with Intern.

Is there a way to make Intern work with esri jsapi without modifying the loader in client.html? It would be ideal to have automated command line execution for these tests as well.

Answer №1

Starting with Intern 1.3, users have the option to specify alternative loaders, such as the one provided by Esri, in the useLoader configuration property. To use the Esri loader, you can include the following:

// intern.js
define({
    /* … other configuration options … */
    useLoader: { 'host-browser': 'http://js.arcgis.com/3.7/' }
    /* … */
});

It is important to note that Esri utilizes the old Dojo 1 loader; if additional criteria like async: true need to be specified in the dojoConfig, you can add the dojoConfig global object within your configuration file:

define([], function () {
    this.dojoConfig = { async: 1 };

    return {
        /* … configuration … */
    };
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Combining Javascript and Django for a powerful web development solution

Having trouble setting up JS on my Django web app, despite reading through the documentation and previous queries. Using the Django dev server with the following file structure: mysite/ __init__.py MySiteDB manage.py settings.py ...

What is the method for inserting a line break into a string that is being transferred to a component in Next JS?

I am currently collaborating on a group project that involves developing a website. One of my team members created a ContentBlock component to facilitate the creation of new pages (see component code below). I have been working on a new page for the site a ...

Troubleshooting the onExited callback issue with Popover component in Material UI

<Popover key={element.name} classes={{ paper: classes.paper }} open={open} anchorEl={this.myRef.current} anchorOrigin={{ vertical: ' ...

Number input in JavaScript being disrupted by stray commas

On my webpage, there are elements that users can control. One of these is a text input field for numbers. When users enter digits like 9000, everything functions correctly. However, if they use comma notation such as 9,000, JavaScript doesn't recogniz ...

Ways to eliminate the top space in the background image

After implementing a basic HTML code to add a background image to my webpage, I noticed there is still some empty space at the top of the page. I attempted to adjust the position of the background image using the following code, but it only lifted it upwar ...

Prevent the box from closing automatically after submitting a form using jQuery

Despite my efforts to keep a simple dialog box open after submitting a form, it continues to close. I tried using the preventDefault method in jQuery, but it didn't solve the issue. Below is the code snippet: $(document).ready(function(e) { $(&apo ...

An error occurred when attempting to use the getDoc() function from Firebase within Next.js: TypeError - reading 'map' on properties of undefined

Hello everyone at StackOverflow, I ran into a problem while attempting to use .map() on a getDoc() constant in my Next.js application. The error message I'm getting is: "TypeError: Cannot read properties of undefined (reading 'map')". As a n ...

Is there a way to remove or replace the existing polyline to ensure that only one is displayed at a time?

My goal is to have a single line drawn from the closest marker to a static position. I can determine which marker is the closest by sorting the distances, but if a new marker is added and is closer than the previous closest one, a new polyline is drawn wit ...

Having trouble sending an array's JSON data to a web service using Angular

I am working with a table where each cell in the rows contains form fields. The table also has two buttons: one button adds a new row to the table, and the other sends all the rows. Below is the code snippet for adding new blank rows: $scope.attributes = ...

vuejs function for modifying an existing note

Method for editing an existing note with Vue.js in a web application This particular application enables users to perform the following tasks: Create a new note View a list of all created notes Edit an existing note Delete an existing note Prog ...

Trigger the Material UI DatePicker to open upon clicking the input field

I have a component that is not receiving the onClick event. I understand that I need to pass a prop with open as a boolean value, but I'm struggling to find a way to trigger it when clicking on MuiDatePicker. Here is an image to show where I want to ...

What is the best way to incorporate a line into a scene using three.js?

I am facing an issue with adding a line in three.js. When I call the addline function in my code, the line doesn't appear in the scene. I have tried to implement the MVC design pattern, but I am unsure where I went wrong. Thank you for any assistance ...

Steps to store radio button selections in local storage

I have a quiz that includes radio buttons, and I need to save the answers on my local storage. However, I am currently stuck and unsure of what else to do. I am learning, so please don't be too hard on me. Thank you! Here is the code I have written s ...

Tips for preserving both existing data and new data within React's useState hook in React Native or ReactJS?

As I dive into learning reactjs, one question that has been on my mind is how to store both previous and upcoming data in useState. Is there a special trick for achieving this? For example: Imagine I enter "A" and then follow it with "B". My goal is to ha ...

Netbeans lacks compatibility with JavaScript

Recently, I've been encountering code errors in my .js files while attempting to edit JavaScript using Netbeans 6.9. Even after upgrading to Netbeans 7.01 and enabling the JAVA plugin, the issue persists. I'm unable to create a new JavaScript tem ...

Encountering error #426 in NextJs when the app is loaded for the first time in a new browser, but only in a

Encountering a strange error exclusively in production, particularly when loading the site for the first time on a new browser or after clearing all caches. The website is built using nextjs 13.2.3 and hosted on Vercel. Refer to the screenshot below: http ...

Passing an array of objects as properties in React components

My functional component looks like this: function ItemList({ items }: ItemProps[]) { return <p>items[0].name</p> } Here is how I'm creating it: <ItemList items={items} /> The array items contains objects in the format [{name: &ap ...

Implementing dynamic title rendering based on image in vue.js

This is the code I'm working with, aiming to display slider data. My goal is that if image[0] appears on the slider, it should return title [0]. I'm quite curious about what could be missing in my setup.code-image ...

What is the proper way to input information into fields during an update?

Let's talk about a scenario: I have a form created using Material UI components (TextFields) that I want to use for both creating and updating products. The product creation part of the form is working well, except when no image is added. For updati ...