> For the complete documentation index, see [llms.txt](https://notes.lirenxn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.lirenxn.com/2019-1/wk-notes-11-29-npm-fix-aem-datalayer-test.md).

# Wk-notes-11-29-npm-fix-aem-datalayer-test

### A11y

Good link: <http://pauljadam.com/demos/aria-atomic-relevant.html>

### npm pkg vulnerability

Use `npm audit fix`

### AEM DataLayer local Test

* Mock global dataLayer

```javascript
window.dataLayer = {
  setEvent: function(e){ 
    console.log(JSON.stringify(e));
    this.digitalData.event.push(e)
  }, 
  digitalData:{ event:[] }
};
```

**NOT a very good solution**, since DataLayer could be injected when the some function being defined (Either due to shitty code or global variable pollution prevention).

* Mock a AEM page with `<scripts>` src to `localhost:PORT`, which is a easy way for local testing with context.
